diff options
author | violoncello.ch <22591354+violoncelloCH@users.noreply.github.com> | 2019-01-11 11:13:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-11 11:13:46 +0100 |
commit | 5d52646353ea22f69533c53d095be6372d1892b0 (patch) | |
tree | 52bf3ecbdbfab50aa438ea2125bcd9af8024d67a | |
parent | 95a087d860cb6ec181a4de1f9576f4c8ba39aeb8 (diff) | |
parent | de5b172a69de4fa788046552a7028a8adcbd1421 (diff) |
Merge pull request #327 from nextcloud/backport/298/alpha1
[alpha1] Properly return promise when creating a new post
-rw-r--r-- | src/store/timeline.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/store/timeline.js b/src/store/timeline.js index c31fb245..e816f41d 100644 --- a/src/store/timeline.js +++ b/src/store/timeline.js @@ -66,12 +66,16 @@ const actions = { context.commit('setAccount', account) }, post(context, post) { - return axios.post(OC.generateUrl('apps/social/api/v1/post'), { data: post }).then((response) => { - // eslint-disable-next-line no-console - console.log('Post created with token ' + response.data.result.token) - }).catch((error) => { - OC.Notification.showTemporary('Failed to create a post') - console.error('Failed to create a post', error) + return new Promise((resolve, reject) => { + axios.post(OC.generateUrl('apps/social/api/v1/post'), { data: post }).then((response) => { + // eslint-disable-next-line no-console + console.log('Post created with token ' + response.data.result.token) + resolve(response) + }).catch((error) => { + OC.Notification.showTemporary('Failed to create a post') + console.error('Failed to create a post', error.response) + reject(error) + }) }) }, refreshTimeline(context) { |