Implement friends list and refactor components #28

Merged
twig merged 24 commits from friends-list into main 2025-07-12 17:28:43 +00:00
Showing only changes of commit 59000709fe - Show all commits

View file

@ -1,4 +1,4 @@
import type { ChannelResponse, GuildMemberResponse, GuildResponse, MessageResponse, StatsResponse } from "~/types/interfaces";
import type { ChannelResponse, GuildMemberResponse, GuildResponse, MessageResponse, StatsResponse, UserResponse } from "~/types/interfaces";
export const useApi = () => {
async function fetchGuilds(): Promise<GuildResponse[] | undefined> {
@ -33,6 +33,10 @@ export const useApi = () => {
return await fetchWithApi(`/users/${userId}`);
}
async function fetchFriends(): Promise<UserResponse[] | undefined> {
return await fetchWithApi('/me/friends')
}
async function fetchMessages(channelId: string, options?: { amount?: number, offset?: number }): Promise<MessageResponse[] | undefined> {
return await fetchWithApi(`/channels/${channelId}/messages`, { query: { amount: options?.amount ?? 100, offset: options?.offset ?? 0 } });
twig marked this conversation as resolved Outdated

Add return for consistency

Add `return` for consistency
}
@ -59,6 +63,7 @@ export const useApi = () => {
fetchMember,
fetchUsers,
fetchUser,
fetchFriends,
fetchMessages,
fetchMessage,
fetchInstanceStats,