@ -1,5 +1,4 @@
/* eslint-env browser */
const BG _UPDATE _URL = '/api/qvitter/update_background_image.json'
const EXTERNAL _PROFILE _URL = '/api/externalprofile/show.json'
const QVITTER _USER _NOTIFICATIONS _READ _URL = '/api/qvitter/statuses/notifications/read.json'
const BLOCKS _IMPORT _URL = '/api/pleroma/blocks_import'
@ -25,7 +24,6 @@ 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 `
@ -133,22 +131,16 @@ const updateAvatar = ({credentials, avatar}) => {
. then ( ( data ) => parseUser ( data ) )
}
const updateBg = ( { credentials , params } ) => {
let url = BG _UPDATE _URL
const updateBg = ( { credentials , background } ) => {
const form = new FormData ( )
each ( params , ( value , key ) => {
if ( value ) {
form . append ( key , value )
}
} )
return fetch ( url , {
form . append ( 'pleroma_background_image' , background )
return fetch ( MASTODON _PROFILE _UPDATE _URL , {
headers : authHeaders ( credentials ) ,
method : 'P OST ',
method : 'PATCH' ,
body : form
} ) . then ( ( data ) => data . json ( ) )
} )
. then ( ( data ) => data . json ( ) )
. then ( ( data ) => parseUser ( data ) )
}
const updateBanner = ( { credentials , banner } ) => {
@ -544,26 +536,6 @@ 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 } ) => {