aboutsummaryrefslogtreecommitdiff
path: root/src/services/api/api.service.js
diff options
context:
space:
mode:
authorBrenden Bice <brenden.next@gmail.com>2019-04-02 12:01:48 -0400
committerBrenden Bice <brenden.next@gmail.com>2019-04-11 23:26:12 -0400
commit0c3a922341a6f04f203396fb1c932411f6df0cd5 (patch)
tree2161ace4f6cda240ff0df6e125440a6dd8758b47 /src/services/api/api.service.js
parent4ab2ddb03cdd3740eb18d8c7d85de80e176db29f (diff)
use promisedRequest for api call
Diffstat (limited to 'src/services/api/api.service.js')
-rw-r--r--src/services/api/api.service.js22
1 files changed, 2 insertions, 20 deletions
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index 120398f0..1f9e9a88 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -725,29 +725,11 @@ const markNotificationsAsSeen = ({id, credentials}) => {
}
const fetchFavouritedByUsers = ({id}) => {
- return fetch(MASTODON_STATUS_FAVOURITEDBY_URL(id), {
- method: 'GET'
- })
- .then(response => {
- if (response.ok) {
- return response.json()
- } else {
- throw new Error('Error fetching favorited by users')
- }
- })
+ return promisedRequest(MASTODON_STATUS_FAVOURITEDBY_URL(id)).then((users) => users.map(parseUser))
}
const fetchRebloggedByUsers = ({id}) => {
- return fetch(MASTODON_STATUS_REBLOGGEDBY_URL(id), {
- method: 'GET'
- })
- .then(response => {
- if (response.ok) {
- return response.json()
- } else {
- throw new Error('Error reblogged by users')
- }
- })
+ return promisedRequest(MASTODON_STATUS_REBLOGGEDBY_URL(id)).then((users) => users.map(parseUser))
}
const apiService = {