update favorite number earlier

This commit is contained in:
taehoon 2019-05-07 23:19:46 -04:00
parent ff3a7e8b5b
commit 28c2a700e1
1 changed files with 9 additions and 0 deletions

View File

@ -402,6 +402,15 @@ export const mutations = {
}, },
setFavorited (state, { status, value }) { setFavorited (state, { status, value }) {
const newStatus = state.allStatusesObject[status.id] const newStatus = state.allStatusesObject[status.id]
if (newStatus.favorited !== value) {
if (value) {
newStatus.fave_num++
} else {
newStatus.fave_num--
}
}
newStatus.favorited = value newStatus.favorited = value
}, },
setFavoritedConfirm (state, { status, user }) { setFavoritedConfirm (state, { status, user }) {