fix conflicts and add error handling to media descriptions
This commit is contained in:
commit
e3991db5c4
9 changed files with 202 additions and 39 deletions
|
@ -1,7 +1,18 @@
|
|||
import { map } from 'lodash'
|
||||
import apiService from '../api/api.service.js'
|
||||
|
||||
const postStatus = ({ store, status, spoilerText, visibility, sensitive, poll, media = [], inReplyToStatusId = undefined, contentType = 'text/plain' }) => {
|
||||
const postStatus = ({
|
||||
store,
|
||||
status,
|
||||
spoilerText,
|
||||
visibility,
|
||||
sensitive,
|
||||
poll,
|
||||
media = [],
|
||||
inReplyToStatusId = undefined,
|
||||
contentType = 'text/plain',
|
||||
preview = false
|
||||
}) => {
|
||||
const mediaIds = map(media, 'id')
|
||||
|
||||
return apiService.postStatus({
|
||||
|
@ -13,10 +24,11 @@ const postStatus = ({ store, status, spoilerText, visibility, sensitive, poll, m
|
|||
mediaIds,
|
||||
inReplyToStatusId,
|
||||
contentType,
|
||||
poll
|
||||
poll,
|
||||
preview
|
||||
})
|
||||
.then((data) => {
|
||||
if (!data.error) {
|
||||
if (!data.error && !preview) {
|
||||
store.dispatch('addNewStatuses', {
|
||||
statuses: [data],
|
||||
timeline: 'friends',
|
||||
|
@ -35,13 +47,11 @@ const postStatus = ({ store, status, spoilerText, visibility, sensitive, poll, m
|
|||
|
||||
const uploadMedia = ({ store, formData }) => {
|
||||
const credentials = store.state.users.currentUser.credentials
|
||||
|
||||
return apiService.uploadMedia({ credentials, formData })
|
||||
}
|
||||
|
||||
const setMediaDescription = ({ store, id, description }) => {
|
||||
const credentials = store.state.users.currentUser.credentials
|
||||
|
||||
return apiService.setMediaDescription({ credentials, id, description })
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue