[Glitch] Refactor <FollowedTags> into TypeScript

Port bdf9baa2e8 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Eugen Rochko authored and Claire committed 2025-04-08 20:43:43 +02:00
1 parent 2e16be22bf
commit c684b1df15
8 files changed
+185 -229

No files matched your search

+17 -1
View File
@@ -1,4 +1,8 @@
import { apiRequestPost, apiRequestGet } from 'flavours/glitch/api';
import api, {
getLinks,
apiRequestPost,
apiRequestGet,
} from 'flavours/glitch/api';
import type { ApiHashtagJSON } from 'flavours/glitch/api_types/tags';
export const apiGetTag = (tagId: string) =>
@@ -9,3 +13,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),
};
};