feat: finish entire friends menu
This commit is contained in:
parent
34976b4f50
commit
0562127e4a
7 changed files with 243 additions and 5 deletions
|
@ -37,6 +37,14 @@ export const useApi = () => {
|
|||
return await fetchWithApi('/me/friends')
|
||||
}
|
||||
|
||||
async function addFriend(username: string): Promise<void> {
|
||||
await fetchWithApi('/me/friends', { method: "POST", body: { username } });
|
||||
}
|
||||
|
||||
async function removeFriend(userId: string): Promise<void> {
|
||||
await fetchWithApi(`/me/friends/${userId}`, { method: "DELETE" });
|
||||
}
|
||||
|
||||
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 } });
|
||||
}
|
||||
|
@ -64,6 +72,8 @@ export const useApi = () => {
|
|||
fetchUsers,
|
||||
fetchUser,
|
||||
fetchFriends,
|
||||
addFriend,
|
||||
removeFriend,
|
||||
fetchMessages,
|
||||
fetchMessage,
|
||||
fetchInstanceStats,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue