Refactor <FollowedTags>
into TypeScript (#34355)
This commit is contained in:
parent
887336f2c6
commit
bdf9baa2e8
8 changed files with 181 additions and 229 deletions
|
@ -1,4 +1,4 @@
|
|||
import { apiRequestPost, apiRequestGet } from 'mastodon/api';
|
||||
import api, { getLinks, apiRequestPost, apiRequestGet } from 'mastodon/api';
|
||||
import type { ApiHashtagJSON } from 'mastodon/api_types/tags';
|
||||
|
||||
export const apiGetTag = (tagId: string) =>
|
||||
|
@ -9,3 +9,15 @@ export const apiFollowTag = (tagId: string) =>
|
|||
|
||||
export const apiUnfollowTag = (tagId: string) =>
|
||||
apiRequestPost<ApiHashtagJSON>(`v1/tags/${tagId}/unfollow`);
|
||||
|
||||
export const apiGetFollowedTags = async (url?: string) => {
|
||||
const response = await api().request<ApiHashtagJSON[]>({
|
||||
method: 'GET',
|
||||
url: url ?? '/api/v1/followed_tags',
|
||||
});
|
||||
|
||||
return {
|
||||
tags: response.data,
|
||||
links: getLinks(response),
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue