update favorite number earlier

This commit is contained in:
taehoon 2019-05-07 23:19:46 -04:00
parent ff3a7e8b5b
commit 28c2a700e1

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 }) {