- //Somehow get info from the server about invitations sent/left etc and then show the box
- new InvitationsDialog().center();
+ GetRequest<Invitations> getInvitations = new GetRequest<Invitations> (Invitations.class, "/im/", "", "invitations") {
+
+ @Override
+ public void onSuccess(Invitations _result) {
+ new InvitationsDialog(app, _result).center();
+ }
+
+ @Override
+ public void onError(Throwable t) {
+ GWT.log("", t);
+ if (t instanceof RestException)
+ app.displayError("Error getting invitations: " + ((RestException) t).getHttpStatusText());
+ else
+ app.displayError("System error getting invitations: " + t.getMessage());
+ }
+
+ @Override
+ protected void onUnauthorized(Response response) {
+ app.sessionExpired();
+ }
+ };
+ getInvitations.setHeader("X-Auth-Token", app.getToken());
+ Scheduler.get().scheduleDeferred(getInvitations);