logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe
commit: 2e77a3ffeff8cf003b6d040623d672ef087c80c2
parent: e53f11c30fb2eedd0a437d3cfe9592c555de6a95
Author: HJ <30-hj@users.noreply.git.pleroma.social>
Date:   Wed, 12 Jun 2019 22:53:24 +0000

Merge branch 'hotfix-user-background' into 'develop'

fix user banner

See merge request pleroma/pleroma-fe!828

Diffstat:

Msrc/services/api/api.service.js22+++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js @@ -25,6 +25,7 @@ const MFA_CONFIRM_OTP_URL = '/api/pleroma/profile/mfa/confirm/totp' const MFA_DISABLE_OTP_URL = '/api/pleroma/profile/mfa/totp' const MASTODON_LOGIN_URL = '/api/v1/accounts/verify_credentials' +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` @@ -532,8 +533,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 }) => {