forked from AkkomaGang/akkoma-fe
use json content type
This commit is contained in:
parent
2c4af6693a
commit
904a64de89
1 changed files with 7 additions and 18 deletions
|
@ -118,27 +118,16 @@ const updateBanner = ({credentials, banner}) => {
|
||||||
.then((data) => parseUser(data))
|
.then((data) => parseUser(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Params
|
|
||||||
// name
|
|
||||||
// url
|
|
||||||
// location
|
|
||||||
// description
|
|
||||||
const updateProfile = ({credentials, params}) => {
|
const updateProfile = ({credentials, params}) => {
|
||||||
// Always include these fields, because they might be empty or false
|
return promisedRequest(MASTODON_PROFILE_UPDATE_URL, {
|
||||||
const fields = ['note', 'locked', 'no_rich_text', 'hide_follows', 'hide_followers', 'show_role']
|
headers: {
|
||||||
const form = new FormData()
|
'Accept': 'application/json',
|
||||||
|
'Content-Type': 'application/json',
|
||||||
each(params, (value, key) => {
|
...authHeaders(credentials)
|
||||||
if (fields.includes(key) || value) {
|
},
|
||||||
form.append(key, value)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return fetch(MASTODON_PROFILE_UPDATE_URL, {
|
|
||||||
headers: authHeaders(credentials),
|
|
||||||
method: 'PATCH',
|
method: 'PATCH',
|
||||||
body: form
|
body: JSON.stringify(params)
|
||||||
})
|
})
|
||||||
.then((data) => data.json())
|
|
||||||
.then((data) => parseUser(data))
|
.then((data) => parseUser(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue