summaryrefslogtreecommitdiffstats
path: root/src/store
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-09-14 12:37:18 +0200
committerCarl Schwan <carl@carlschwan.eu>2022-09-14 12:37:18 +0200
commite037394a50297cbcffc5dc3a2d3adad7f26fcd4d (patch)
tree3d266d5a1c451a2767b367ad7e16c6a5cfb55411 /src/store
parentb423ac536c10ff93c56d58f4e3dad0f5f40a1ee9 (diff)
Make uploading files work
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'src/store')
-rw-r--r--src/store/timeline.js22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/store/timeline.js b/src/store/timeline.js
index 031f3306..f80b72b0 100644
--- a/src/store/timeline.js
+++ b/src/store/timeline.js
@@ -144,17 +144,19 @@ const actions = {
context.commit('setTimelineType', 'account')
context.commit('setAccount', account)
},
- post(context, post) {
- return new Promise((resolve, reject) => {
- axios.post(generateUrl('apps/social/api/v1/post'), { data: post }).then((response) => {
- Logger.info('Post created with token ' + response.data.result.token)
- resolve(response)
- }).catch((error) => {
- OC.Notification.showTemporary('Failed to create a post')
- Logger.error('Failed to create a post', { 'error': error.response })
- reject(error)
+ async post(context, post) {
+ try {
+ const { data } = axios.post(generateUrl('apps/social/api/v1/post'), post, {
+ headers: {
+ 'Content-Type': 'multipart/form-data'
+ }
})
- })
+ Logger.info('Post created with token ' + data.result.token)
+ } catch (error) {
+ OC.Notification.showTemporary('Failed to create a post')
+ console.error(error)
+ Logger.error('Failed to create a post', { 'error': error.response })
+ }
},
postDelete(context, post) {
return axios.delete(generateUrl(`apps/social/api/v1/post?id=${post.id}`)).then((response) => {