use of com.willshex.blogwt.shared.api.user.call.LogoutResponse in project blogwt by billy1380.
the class SessionController method logout.
public void logout(PageType pageType, String... params) {
UserService userService = ApiHelper.createUserClient();
final LogoutRequest input = setSession(ApiHelper.setAccessCode(new LogoutRequest()));
userService.logout(input, new AsyncCallback<LogoutResponse>() {
@Override
public void onSuccess(LogoutResponse output) {
DefaultEventBus.get().fireEventFromSource(new LogoutEventHandler.LogoutSuccess(input, output), SessionController.this);
}
@Override
public void onFailure(Throwable caught) {
DefaultEventBus.get().fireEventFromSource(new LogoutEventHandler.LogoutFailure(input, caught), SessionController.this);
}
});
session = null;
Cookies.removeCookie(COOKIE_KEY_ID);
if (pageType != null) {
PageTypeHelper.show(pageType, params);
}
}
use of com.willshex.blogwt.shared.api.user.call.LogoutResponse in project blogwt by billy1380.
the class UserService method logout.
public Request logout(LogoutRequest input, AsyncSuccess<LogoutRequest, LogoutResponse> onSuccess, AsyncFailure<LogoutRequest> onFailure) {
Request handle = null;
try {
handle = sendRequest(UserMethodLogout, input, new RequestCallback() {
@Override
public void onResponseReceived(Request request, Response response) {
try {
LogoutResponse outputParameter = new LogoutResponse();
parseResponse(response, outputParameter);
if (onSuccess != null) {
onSuccess.call(input, outputParameter);
}
onCallSuccess(UserService.this, UserMethodLogout, input, outputParameter);
} catch (JSONException | HttpException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(UserService.this, UserMethodLogout, input, exception);
}
}
@Override
public void onError(Request request, Throwable exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(UserService.this, UserMethodLogout, input, exception);
}
});
onCallStart(UserService.this, UserMethodLogout, input, handle);
} catch (RequestException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(UserService.this, UserMethodLogout, input, exception);
}
return handle;
}
Aggregations