use json content type

This commit is contained in:
taehoon 2019-04-27 14:20:32 -04:00
parent 2c4af6693a
commit 904a64de89

View file

@ -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))
} }