diff options
| author | taehoon <th.dev91@gmail.com> | 2019-03-20 11:54:16 -0400 |
|---|---|---|
| committer | taehoon <th.dev91@gmail.com> | 2019-05-03 11:40:05 -0400 |
| commit | 02d169b92c61015a5663b703a23e769848239b13 (patch) | |
| tree | c947a410a3dbcfd952054dc3a012aaa2fc988d0b | |
| parent | cea6ea42f0f882864e01f79a8af08c8bc59272fb (diff) | |
add promisedRequest helper
| -rw-r--r-- | src/services/api/api.service.js | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 9753049f..a19aff9f 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -724,21 +724,17 @@ const fetchRebloggedByUsers = ({id}) => { } const reportUser = ({credentials, userId, statusIds, comment, forward}) => { - const payload = { - 'account_id': userId, - 'status_ids': statusIds, - comment, - forward - } - return fetch(MASTODON_REPORT_USER_URL, { - body: JSON.stringify(payload), - headers: { - ...authHeaders(credentials), - 'Accept': 'application/json', - 'Content-Type': 'application/json' + return promisedRequest({ + uri: MASTODON_REPORT_USER_URL, + method: 'POST', + payload: { + 'account_id': userId, + 'status_ids': statusIds, + comment, + forward }, - method: 'POST' - }).then((data) => data.json()) + credentials + }) } const apiService = { |
