some consistency

This commit is contained in:
Henry Jameson 2019-01-17 23:01:38 +03:00
parent a680f7d684
commit 8f4fbf8571
3 changed files with 12 additions and 5 deletions

View File

@ -209,7 +209,7 @@ const users = {
store.rootState.api.backendInteractor.verifyCredentials(accessToken)
.then((data) => {
if (!data.error) {
const { user } = data
const user = data
// user.credentials = userCredentials
user.credentials = accessToken
commit('setCurrentUser', user)

View File

@ -375,9 +375,7 @@ const verifyCredentials = (user) => {
}
}
})
.then((data) => ({
user: parseUser(data)
}))
.then((data) => data.error ? data : parseUser(data))
}
const favorite = ({ id, credentials }) => {
@ -429,6 +427,16 @@ const postStatus = ({credentials, status, spoilerText, visibility, sensitive, me
method: 'POST',
headers: authHeaders(credentials)
})
.then((response) => {
if (response.ok) {
return response.json()
} else {
return {
error: response
}
}
})
.then((data) => data.error ? data : parseStatus(data))
}
const deleteStatus = ({ id, credentials }) => {

View File

@ -5,7 +5,6 @@ const postStatus = ({ store, status, spoilerText, visibility, sensitive, media =
const mediaIds = map(media, 'id')
return apiService.postStatus({credentials: store.state.users.currentUser.credentials, status, spoilerText, visibility, sensitive, mediaIds, inReplyToStatusId, contentType, noAttachmentLinks: store.state.instance.noAttachmentLinks})
.then((data) => data.json())
.then((data) => {
if (!data.error) {
store.dispatch('addNewStatuses', {