diff options
| author | Brenden Bice <brenden.next@gmail.com> | 2019-04-01 22:29:45 -0400 |
|---|---|---|
| committer | Brenden Bice <brenden.next@gmail.com> | 2019-04-11 23:26:12 -0400 |
| commit | 2d339cd3b8b3ffc1509c954f68636d8ed4d37253 (patch) | |
| tree | 0f32e01495eff840132faa00bc10979bf8fc5965 /src/services/api/api.service.js | |
| parent | fd3811d651f5be0c74f33850df2e95ed18f86a0c (diff) | |
fetch favorited users
Diffstat (limited to 'src/services/api/api.service.js')
| -rw-r--r-- | src/services/api/api.service.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 2dd52cb5..45eec566 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -49,6 +49,7 @@ const MASTODON_MUTE_USER_URL = id => `/api/v1/accounts/${id}/mute` const MASTODON_UNMUTE_USER_URL = id => `/api/v1/accounts/${id}/unmute` const MASTODON_POST_STATUS_URL = '/api/v1/statuses' const MASTODON_MEDIA_UPLOAD_URL = '/api/v1/media' +const MASTODON_STATUS_FAVOURITEDBY_URL = id => `/api/v1/statuses/${id}/favourited_by` import { each, map } from 'lodash' import { parseStatus, parseUser, parseNotification, parseAttachment } from '../entity_normalizer/entity_normalizer.service.js' @@ -722,6 +723,32 @@ const markNotificationsAsSeen = ({id, credentials}) => { }).then((data) => data.json()) } +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') + } + }) +} + +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') + } + }) +} + const apiService = { verifyCredentials, fetchTimeline, |
