Search in sources :

Example 1 with UserService

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);
    }
}
Also used : LogoutResponse(com.willshex.blogwt.shared.api.user.call.LogoutResponse) UserService(com.willshex.blogwt.client.api.user.UserService) LogoutRequest(com.willshex.blogwt.shared.api.user.call.LogoutRequest)

Example 2 with UserService

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;
}
Also used : UserService(com.willshex.blogwt.client.api.user.UserService)

Example 3 with UserService

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));
}
Also used : UserService(com.willshex.blogwt.client.api.user.UserService) LoginRequest(com.willshex.blogwt.shared.api.user.call.LoginRequest)

Example 4 with UserService

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));
}
Also used : UserService(com.willshex.blogwt.client.api.user.UserService) LoginRequest(com.willshex.blogwt.shared.api.user.call.LoginRequest)

Aggregations

UserService (com.willshex.blogwt.client.api.user.UserService)4 LoginRequest (com.willshex.blogwt.shared.api.user.call.LoginRequest)2 LogoutRequest (com.willshex.blogwt.shared.api.user.call.LogoutRequest)1 LogoutResponse (com.willshex.blogwt.shared.api.user.call.LogoutResponse)1