Fetch list of lists from the API

This commit is contained in:
Sol Fisher Romanoff 2022-06-15 18:34:11 +03:00
parent d5d464a289
commit e18e179a59
No known key found for this signature in database
GPG key ID: 9D3F2B64F2341B62
4 changed files with 52 additions and 1 deletions

View file

@ -79,6 +79,7 @@ const MASTODON_SEARCH_2 = `/api/v2/search`
const MASTODON_USER_SEARCH_URL = '/api/v1/accounts/search'
const MASTODON_MASCOT_URL = '/api/v1/pleroma/mascot'
const MASTODON_DOMAIN_BLOCKS_URL = '/api/v1/domain_blocks'
const MASTODON_LISTS_URL = '/api/v1/lists'
const MASTODON_STREAMING = '/api/v1/streaming'
const MASTODON_KNOWN_DOMAIN_LIST_URL = '/api/v1/instance/peers'
const PLEROMA_EMOJI_REACTIONS_URL = id => `/api/v1/pleroma/statuses/${id}/reactions`
@ -383,6 +384,12 @@ const fetchFollowRequests = ({ credentials }) => {
.then((data) => data.map(parseUser))
}
const fetchLists = ({ credentials }) => {
const url = MASTODON_LISTS_URL
return fetch(url, { headers: authHeaders(credentials) })
.then((data) => data.json())
}
const fetchConversation = ({ id, credentials }) => {
let urlContext = MASTODON_STATUS_CONTEXT_URL(id)
return fetch(urlContext, { headers: authHeaders(credentials) })
@ -1355,6 +1362,7 @@ const apiService = {
mfaSetupOTP,
mfaConfirmOTP,
fetchFollowRequests,
fetchLists,
approveUser,
denyUser,
suggestions,