GH-4907 Move Client.updatePost call into an action (#5045)

* move Client.updatePost into an action

Client.updatePost where called from components so they needed to be moved inside action and call that action from component instead

fixes #4907

* move loadPost in updatePost callback

* Add loadPosts call in updatePost action

* Lint: remove trailing spaces
Этот коммит содержится в:
Mika Andrianarijaona
2017-01-13 16:48:49 +03:00
коммит произвёл enahum
родитель 6c814c72ec
Коммит e69809dce3
2 изменённых файлов: 18 добавлений и 10 удалений

Просмотреть файл

@@ -363,6 +363,21 @@ export function createPost(post, doLoadPost, success, error) {
);
}
export function updatePost(post, success) {
Client.updatePost(
post,
() => {
loadPosts(post.channel_id);
if (success) {
success();
}
},
(err) => {
AsyncClient.dispatchError(err, 'updatePost');
});
}
export function removePostFromStore(post) {
PostStore.removePost(post);
PostStore.emitChange();