clean up fetchPinnedStatuses api service

This commit is contained in:
taehoon 2019-04-24 21:52:50 -04:00
parent 8308315038
commit 93e9bc019e

View file

@ -506,14 +506,7 @@ const fetchTimeline = ({timeline, credentials, since = false, until = false, use
const fetchPinnedStatuses = ({ id, credentials }) => { const fetchPinnedStatuses = ({ id, credentials }) => {
const url = MASTODON_USER_TIMELINE_URL(id) + '?pinned=true' const url = MASTODON_USER_TIMELINE_URL(id) + '?pinned=true'
return fetch(url, { headers: authHeaders(credentials) }) return promisedRequest(url, { headers: authHeaders(credentials) })
.then((data) => {
if (data.ok) {
return data
}
throw new Error('Error fetching pinned timeline', data)
})
.then((data) => data.json())
.then((data) => data.map(parseStatus)) .then((data) => data.map(parseStatus))
} }