feat: sort friends alphabetically

This commit is contained in:
Twig 2025-07-16 10:22:04 +02:00
parent 0f583f085e
commit ace66980bf
No known key found for this signature in database
3 changed files with 17 additions and 3 deletions

View file

@ -33,8 +33,13 @@ export const useApi = () => {
return await fetchWithApi(`/users/${userId}`);
}
async function fetchFriends(): Promise<UserResponse[] | undefined> {
return await fetchWithApi('/me/friends')
async function fetchFriends(): Promise<UserResponse[]> {
const response = await fetchWithApi('/me/friends')
if (Array.isArray(response)) {
return response
} else {
return []
}
}
async function addFriend(username: string): Promise<void> {