aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2019-06-13 10:05:53 +0300
committerHenry Jameson <me@hjkos.com>2019-06-13 10:05:53 +0300
commitf9c3aabea4438f23b725e3f41ffddc85e07b4da5 (patch)
treee335ab5832305c4e24ae7109dd6f6e854c8dc163
parent0988065f50f8614846efe762d7703b11a349abbb (diff)
parent2e77a3ffeff8cf003b6d040623d672ef087c80c2 (diff)
Merge remote-tracking branch 'upstream/develop' into masto-register-app-secret
* upstream/develop: fix user banner
-rw-r--r--src/services/api/api.service.js22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index f87d5d80..05d968f7 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -25,6 +25,7 @@ const MFA_DISABLE_OTP_URL = '/api/pleroma/profile/mfa/totp'
const MASTODON_LOGIN_URL = '/api/v1/accounts/verify_credentials'
const MASTODON_REGISTRATION_URL = '/api/v1/accounts'
+const GET_BACKGROUND_HACK = '/api/account/verify_credentials.json'
const MASTODON_USER_FAVORITES_TIMELINE_URL = '/api/v1/favourites'
const MASTODON_USER_NOTIFICATIONS_URL = '/api/v1/notifications'
const MASTODON_FAVORITE_URL = id => `/api/v1/statuses/${id}/favourite`
@@ -542,8 +543,27 @@ const verifyCredentials = (user) => {
}
}
})
-
.then((data) => data.error ? data : parseUser(data))
+ .then((mastoUser) => {
+ // REMOVE WHEN BE SUPPORTS background_image
+ return fetch(GET_BACKGROUND_HACK, {
+ method: 'POST',
+ headers: authHeaders(user)
+ })
+ .then((response) => {
+ if (response.ok) {
+ return response.json()
+ } else {
+ return {}
+ }
+ })
+ /* eslint-disable camelcase */
+ .then(({ background_image }) => ({
+ ...mastoUser,
+ background_image
+ }))
+ /* eslint-enable camelcase */
+ })
}
const favorite = ({ id, credentials }) => {