From 904a64de8951356d0e1a798349661039d5821d32 Mon Sep 17 00:00:00 2001
From: taehoon
Date: Sat, 27 Apr 2019 14:20:32 -0400
Subject: [PATCH] use json content type
---
src/services/api/api.service.js | 25 +++++++------------------
1 file changed, 7 insertions(+), 18 deletions(-)
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index 9338c495a5..1cf47bb80f 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -118,27 +118,16 @@ const updateBanner = ({credentials, banner}) => {
.then((data) => parseUser(data))
}
-// Params
-// name
-// url
-// location
-// description
const updateProfile = ({credentials, params}) => {
- // Always include these fields, because they might be empty or false
- const fields = ['note', 'locked', 'no_rich_text', 'hide_follows', 'hide_followers', 'show_role']
- const form = new FormData()
-
- each(params, (value, key) => {
- if (fields.includes(key) || value) {
- form.append(key, value)
- }
- })
- return fetch(MASTODON_PROFILE_UPDATE_URL, {
- headers: authHeaders(credentials),
+ return promisedRequest(MASTODON_PROFILE_UPDATE_URL, {
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json',
+ ...authHeaders(credentials)
+ },
method: 'PATCH',
- body: form
+ body: JSON.stringify(params)
})
- .then((data) => data.json())
.then((data) => parseUser(data))
}