use of com.willshex.blogwt.client.api.user.UserService 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.client.api.user.UserService in project blogwt by billy1380.
the class ApiHelper method createUserClient.
public static UserService createUserClient() {
UserService service = new UserService();
service.setUrl(USER_END_POINT);
service.setBus(DefaultEventBus.get());
return service;
}
use of com.willshex.blogwt.client.api.user.UserService in project blogwt by billy1380.
the class SessionController method login.
public void login(String username, String password, boolean rememberMe) {
UserService userService = ApiHelper.createUserClient();
final LoginRequest input = ApiHelper.setAccessCode(new LoginRequest()).username(username).password(password).longTerm(Boolean.valueOf(rememberMe));
userService.login(input, createAsyncResponse(input));
}
use of com.willshex.blogwt.client.api.user.UserService in project blogwt by billy1380.
the class SessionController method restoreSession.
public void restoreSession() {
UserService userService = ApiHelper.createUserClient();
final LoginRequest input = setSession(ApiHelper.setAccessCode(new LoginRequest()));
userService.login(input, createAsyncResponse(input));
}
Aggregations