Refactor <FollowedTags> into TypeScript (#34355)

This commit is contained in:
Eugen Rochko 2025-04-08 18:06:23 +02:00 committed by GitHub
parent 887336f2c6
commit bdf9baa2e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 181 additions and 229 deletions

View file

@ -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),
};
};