Search in sources :

Example 1 with DeletePostFailure

use of com.willshex.blogwt.client.api.blog.event.DeletePostEventHandler.DeletePostFailure in project blogwt by billy1380.

the class PostController method deletePost.

public void deletePost(Post post) {
    final DeletePostRequest input = SessionController.get().setSession(ApiHelper.setAccessCode(new DeletePostRequest())).post(post);
    ApiHelper.createBlogClient().deletePost(input, new AsyncCallback<DeletePostResponse>() {

        @Override
        public void onSuccess(DeletePostResponse output) {
            if (output.status == StatusType.StatusTypeSuccess) {
                if (input.post != null) {
                    fetchPosts();
                }
            }
            DefaultEventBus.get().fireEventFromSource(new DeletePostSuccess(input, output), PostController.this);
        }

        @Override
        public void onFailure(Throwable caught) {
            DefaultEventBus.get().fireEventFromSource(new DeletePostFailure(input, caught), PostController.this);
        }
    });
}
Also used : DeletePostResponse(com.willshex.blogwt.shared.api.blog.call.DeletePostResponse) DeletePostFailure(com.willshex.blogwt.client.api.blog.event.DeletePostEventHandler.DeletePostFailure) DeletePostRequest(com.willshex.blogwt.shared.api.blog.call.DeletePostRequest) DeletePostSuccess(com.willshex.blogwt.client.api.blog.event.DeletePostEventHandler.DeletePostSuccess)

Aggregations

DeletePostFailure (com.willshex.blogwt.client.api.blog.event.DeletePostEventHandler.DeletePostFailure)1 DeletePostSuccess (com.willshex.blogwt.client.api.blog.event.DeletePostEventHandler.DeletePostSuccess)1 DeletePostRequest (com.willshex.blogwt.shared.api.blog.call.DeletePostRequest)1 DeletePostResponse (com.willshex.blogwt.shared.api.blog.call.DeletePostResponse)1