fix conflicts and add error handling to media descriptions

This commit is contained in:
Shpuld Shpuldson 2020-07-07 10:01:37 +03:00
commit e3991db5c4
9 changed files with 202 additions and 39 deletions

View file

@ -645,7 +645,8 @@ const postStatus = ({
poll,
mediaIds = [],
inReplyToStatusId,
contentType
contentType,
preview
}) => {
const form = new FormData()
const pollOptions = poll.options || []
@ -675,6 +676,9 @@ const postStatus = ({
if (inReplyToStatusId) {
form.append('in_reply_to_id', inReplyToStatusId)
}
if (preview) {
form.append('preview', 'true')
}
return fetch(MASTODON_POST_STATUS_URL, {
body: form,
@ -682,13 +686,7 @@ const postStatus = ({
headers: authHeaders(credentials)
})
.then((response) => {
if (response.ok) {
return response.json()
} else {
return {
error: response
}
}
return response.json()
})
.then((data) => data.error ? data : parseStatus(data))
}