forked from AkkomaGang/akkoma-fe
use promisedRequest for api call
This commit is contained in:
parent
4ab2ddb03c
commit
0c3a922341
1 changed files with 2 additions and 20 deletions
|
@ -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 = {
|
||||||
|
|
Loading…
Reference in a new issue