diff options
| author | dave <starpumadev@gmail.com> | 2019-04-04 15:10:34 -0400 |
|---|---|---|
| committer | taehoon <th.dev91@gmail.com> | 2019-05-15 12:04:24 -0400 |
| commit | 2c89d49a3d22ed2813a6a57fb6049341fa8624ba (patch) | |
| tree | 4e7e97bdadc4a1aeeac28a8258c429a991efecb2 /src/services/api/api.service.js | |
| parent | e28b19645aa6a546f8d1980fa479f20d3c48ff36 (diff) | |
#468 - show pinned timeline and add pinned label to the status
Diffstat (limited to 'src/services/api/api.service.js')
| -rw-r--r-- | src/services/api/api.service.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 65cebe78..03137d20 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -506,6 +506,19 @@ const fetchTimeline = ({timeline, credentials, since = false, until = false, use .then((data) => data.map(isNotifications ? parseNotification : parseStatus)) } +const fetchPinnedStatuses = ({ id, credentials }) => { + const url = MASTODON_USER_TIMELINE_URL(id) + '?pinned=true' + return fetch(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)) +} + const verifyCredentials = (user) => { return fetch(LOGIN_URL, { method: 'POST', @@ -726,6 +739,7 @@ const reportUser = ({credentials, userId, statusIds, comment, forward}) => { const apiService = { verifyCredentials, fetchTimeline, + fetchPinnedStatuses, fetchConversation, fetchStatus, fetchFriends, |
