summaryrefslogtreecommitdiffstats
path: root/src/store
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2019-01-11 10:15:31 +0100
committerJulius Härtl <jus@bitgrid.net>2019-02-20 21:05:24 +0100
commitfb65b686feaa81cd2e0f177acf92e1d5095de1b3 (patch)
treed698c1e3ac9a4492dc02c7b4adb2578bfcc67f38 /src/store
parent80b7c572215e4f7d2efabbe88a5669140d33834a (diff)
Implement post deletion and add animation to timeline list
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'src/store')
-rw-r--r--src/store/timeline.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/store/timeline.js b/src/store/timeline.js
index be1ca66c..38f9e090 100644
--- a/src/store/timeline.js
+++ b/src/store/timeline.js
@@ -37,6 +37,9 @@ const mutations = {
Vue.set(state.timeline, data[item].id, data[item])
}
},
+ removePost(state, post) {
+ Vue.delete(state.timeline, post.id)
+ },
resetTimeline(state) {
state.timeline = {}
state.since = Math.floor(Date.now() / 1000) + 1
@@ -83,6 +86,16 @@ const actions = {
})
})
},
+ postDelete(context, post) {
+ return axios.delete(OC.generateUrl(`apps/social/api/v1/post?id=${post.id}`)).then((response) => {
+ context.commit('removePost', post)
+ // eslint-disable-next-line no-console
+ console.log('Post deleted with token ' + response.data.result.token)
+ }).catch((error) => {
+ OC.Notification.showTemporary('Failed to delete the post')
+ console.error('Failed to delete the post', error)
+ })
+ },
refreshTimeline(context) {
return this.dispatch('fetchTimeline', { sinceTimestamp: Math.floor(Date.now() / 1000) + 1 })
},