use promisedRequest for api call

This commit is contained in:
Brenden Bice 2019-04-02 12:01:48 -04:00
parent 4ab2ddb03c
commit 0c3a922341

View file

@ -725,29 +725,11 @@ const markNotificationsAsSeen = ({id, credentials}) => {
} }
const fetchFavouritedByUsers = ({id}) => { const fetchFavouritedByUsers = ({id}) => {
return fetch(MASTODON_STATUS_FAVOURITEDBY_URL(id), { return promisedRequest(MASTODON_STATUS_FAVOURITEDBY_URL(id)).then((users) => users.map(parseUser))
method: 'GET'
})
.then(response => {
if (response.ok) {
return response.json()
} else {
throw new Error('Error fetching favorited by users')
}
})
} }
const fetchRebloggedByUsers = ({id}) => { const fetchRebloggedByUsers = ({id}) => {
return fetch(MASTODON_STATUS_REBLOGGEDBY_URL(id), { return promisedRequest(MASTODON_STATUS_REBLOGGEDBY_URL(id)).then((users) => users.map(parseUser))
method: 'GET'
})
.then(response => {
if (response.ok) {
return response.json()
} else {
throw new Error('Error reblogged by users')
}
})
} }
const apiService = { const apiService = {