diff --git a/src/main/events/profile/get-friend-requests.ts b/src/main/events/profile/get-friend-requests.ts index 2c04b865..11d8a884 100644 --- a/src/main/events/profile/get-friend-requests.ts +++ b/src/main/events/profile/get-friend-requests.ts @@ -4,8 +4,8 @@ import { FriendRequest } from "@types"; const getFriendRequests = async ( _event: Electron.IpcMainInvokeEvent -): Promise => { - return HydraApi.get(`/profile/friend-requests`).catch(() => null); +): Promise => { + return HydraApi.get(`/profile/friend-requests`).catch(() => []); }; registerEvent("getFriendRequests", getFriendRequests); diff --git a/src/renderer/src/declaration.d.ts b/src/renderer/src/declaration.d.ts index 2cc8afff..bb89f84e 100644 --- a/src/renderer/src/declaration.d.ts +++ b/src/renderer/src/declaration.d.ts @@ -134,7 +134,7 @@ declare global { displayName: string, newProfileImagePath: string | null ) => Promise; - getFriendRequests: () => Promise; + getFriendRequests: () => Promise; updateFriendRequest: ( userId: string, action: FriendRequestAction diff --git a/src/renderer/src/hooks/use-user-details.ts b/src/renderer/src/hooks/use-user-details.ts index 5e893a2e..a0da950a 100644 --- a/src/renderer/src/hooks/use-user-details.ts +++ b/src/renderer/src/hooks/use-user-details.ts @@ -91,7 +91,7 @@ export function useUserDetails() { const updateFriendRequests = useCallback(async () => { const friendRequests = await window.electron.getFriendRequests(); - dispatch(setFriendRequests(friendRequests || [])); + dispatch(setFriendRequests(friendRequests)); }, [dispatch]); const showFriendsModal = useCallback( diff --git a/src/renderer/src/pages/shared-modals/user-friend-modal/user-friend-modal-add-friend.tsx b/src/renderer/src/pages/shared-modals/user-friend-modal/user-friend-modal-add-friend.tsx index f925ca65..bf4879b2 100644 --- a/src/renderer/src/pages/shared-modals/user-friend-modal/user-friend-modal-add-friend.tsx +++ b/src/renderer/src/pages/shared-modals/user-friend-modal/user-friend-modal-add-friend.tsx @@ -119,7 +119,7 @@ export const UserFriendModalAddFriend = ({ }} >

Pendentes

- {friendRequests?.map((request) => { + {friendRequests.map((request) => { return (

{t("activity")}

- {!userProfile.recentGames?.length ? ( + {!userProfile.recentGames.length ? (
@@ -295,7 +295,7 @@ export function UserContent({ }} />

- {userProfile.libraryGames?.length} + {userProfile.libraryGames.length}

{t("total_play_time", { amount: formatPlayTime() })} @@ -306,7 +306,7 @@ export function UserContent({ gap: `${SPACING_UNIT}px`, }} > - {userProfile.libraryGames?.map((game) => ( + {userProfile.libraryGames.map((game) => ( @@ -355,7 +355,7 @@ export function UserContent({ gap: `${SPACING_UNIT}px`, }} > - {userProfile.friends?.map((friend) => { + {userProfile.friends.map((friend) => { return (