summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2019-05-04 13:11:39 +0200
committerMaxence Lange <maxence@artificial-owl.com>2019-05-06 20:31:11 -0100
commit3d45ecfbcc3f6f4cf30104d9527fc412d0ab1d46 (patch)
tree8a5a1c220b0dd9d5efed0b924775093464455686 /src
parent7bd08f841ab1e3425cd82e2d6722806479116c63 (diff)
Use mutation to change vuex store
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'src')
-rw-r--r--src/store/timeline.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/store/timeline.js b/src/store/timeline.js
index d6c26a82..f2d72d76 100644
--- a/src/store/timeline.js
+++ b/src/store/timeline.js
@@ -53,6 +53,12 @@ const mutations = {
},
setAccount(state, account) {
state.account = account
+ },
+ boostPost(state, post) {
+ Vue.set(state.timeline[post.id].action.values, 'boosted', true)
+ },
+ unboostPost(state, post) {
+ Vue.set(state.timeline[post.id].action.values, 'boosted', false)
}
}
const getters = {
@@ -100,7 +106,7 @@ const actions = {
postBoost(context, post) {
return new Promise((resolve, reject) => {
axios.post(OC.generateUrl(`apps/social/api/v1/post/boost?postId=${post.id}`)).then((response) => {
- post.action.values.boosted = true
+ context.commit('boostPost', post)
// eslint-disable-next-line no-console
console.log('Post boosted with token ' + response.data.result.token)
resolve(response)
@@ -113,7 +119,7 @@ const actions = {
},
postUnBoost(context, post) {
return axios.delete(OC.generateUrl(`apps/social/api/v1/post/boost?postId=${post.id}`)).then((response) => {
- post.action.values.boosted = false
+ context.commit('unboostPost', post)
// eslint-disable-next-line no-console
console.log('Boost deleted with token ' + response.data.result.token)
}).catch((error) => {