diff options
author | Jonas Sulzer <jonas@violoncello.ch> | 2019-03-12 16:38:15 +0100 |
---|---|---|
committer | Maxence Lange <maxence@artificial-owl.com> | 2019-05-03 16:30:39 -0100 |
commit | 7626c31c6f74f35d2f040ee04d048ae70c897922 (patch) | |
tree | d60270696ee694fae68974b63838801eb25d47e7 /src/store | |
parent | e74381fde255daa3ca6179f5c598365b12780f55 (diff) |
📦 NEW: boost frontend (button)
Signed-off-by: Jonas Sulzer <jonas@violoncello.ch>
Diffstat (limited to 'src/store')
-rw-r--r-- | src/store/timeline.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/store/timeline.js b/src/store/timeline.js index 38f9e090..8398c0ed 100644 --- a/src/store/timeline.js +++ b/src/store/timeline.js @@ -96,6 +96,19 @@ const actions = { console.error('Failed to delete the post', error) }) }, + postBoost(context, post) { + return new Promise((resolve, reject) => { + axios.post(OC.generateUrl(`apps/social/api/v1/boost?postId=${post.id}`)).then((response) => { + // eslint-disable-next-line no-console + console.log('Post boosted with token ' + response.data.result.token) + resolve(response) + }).catch((error) => { + OC.Notification.showTemporary('Failed to create a boost post') + console.error('Failed to create a boost post', error.response) + reject(error) + }) + }) + }, refreshTimeline(context) { return this.dispatch('fetchTimeline', { sinceTimestamp: Math.floor(Date.now() / 1000) + 1 }) }, |