feat: add /friends page and /settings/friends top-friends management
Some checks failed
lint / lint (push) Failing after 8m39s
test / unit (push) Successful in 16m39s

This commit is contained in:
2026-05-28 04:22:26 +02:00
parent e406464f9f
commit 43e36c743b
7 changed files with 388 additions and 0 deletions

View File

@@ -480,6 +480,37 @@ export const getRemoteFollowing = (token: string) =>
token
);
// ── Friends ───────────────────────────────────────────────────────────────
export const getMyFriends = (token: string, page = 1, perPage = 50) =>
apiFetch(
`/users/me/friends?page=${page}&per_page=${perPage}`,
{ cache: "no-store" },
z.object({
items: z.array(UserSchema),
total: z.number(),
page: z.number(),
perPage: z.number(),
}),
token
);
export const getMyRemoteFriends = (token: string) =>
apiFetch(
"/federation/me/friends",
{ cache: "no-store" },
z.array(RemoteActorSchema),
token
);
export const setTopFriends = (token: string, friendIds: string[]) =>
apiFetch(
"/users/me/top-friends",
{ method: "PUT", body: JSON.stringify({ friendIds }) },
z.null(),
token
);
export const unfollowRemoteActor = (handle: string, token: string) =>
apiFetch(
"/federation/me/following",