From 28c2a700e1f06ac8f718d1b6c8b571720f4777b4 Mon Sep 17 00:00:00 2001
From: taehoon
Date: Tue, 7 May 2019 23:19:46 -0400
Subject: [PATCH] update favorite number earlier
---
src/modules/statuses.js | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/modules/statuses.js b/src/modules/statuses.js
index 9556c6d4..f384c6d3 100644
--- a/src/modules/statuses.js
+++ b/src/modules/statuses.js
@@ -402,6 +402,15 @@ export const mutations = {
},
setFavorited (state, { status, value }) {
const newStatus = state.allStatusesObject[status.id]
+
+ if (newStatus.favorited !== value) {
+ if (value) {
+ newStatus.fave_num++
+ } else {
+ newStatus.fave_num--
+ }
+ }
+
newStatus.favorited = value
},
setFavoritedConfirm (state, { status, user }) {