diff --git a/src/renderer/src/context/user-profile/user-profile.context.tsx b/src/renderer/src/context/user-profile/user-profile.context.tsx index cb656be2..87e2a669 100644 --- a/src/renderer/src/context/user-profile/user-profile.context.tsx +++ b/src/renderer/src/context/user-profile/user-profile.context.tsx @@ -66,10 +66,7 @@ export function UserProfileContextProvider({ const isMe = userDetails?.id === userProfile?.id; const getHeroBackgroundFromImageUrl = async (imageUrl: string) => { - const output = await average(imageUrl, { - amount: 1, - format: "hex", - }); + const output = await average(imageUrl, { amount: 1, format: "hex" }); return `linear-gradient(135deg, ${darkenColor(output as string, 0.5)}, ${darkenColor(output as string, 0.6, 0.5)})`; }; @@ -135,28 +132,25 @@ export function UserProfileContextProvider({ getUserLibraryGames(); return window.electron.hydraApi - .get(`/users/${userId}`) + .get(`/users/${userId}`) .then((userProfile) => { - if (userProfile) { - setUserProfile(userProfile); + setUserProfile(userProfile); - if (userProfile.profileImageUrl) { - getHeroBackgroundFromImageUrl(userProfile.profileImageUrl).then( - (color) => setHeroBackground(color) - ); - } - } else { - showErrorToast(t("user_not_found")); - navigate(-1); + if (userProfile.profileImageUrl) { + getHeroBackgroundFromImageUrl(userProfile.profileImageUrl).then( + (color) => setHeroBackground(color) + ); } + }) + .catch(() => { + showErrorToast(t("user_not_found")); + navigate(-1); }); }, [navigate, getUserStats, getUserLibraryGames, showErrorToast, userId, t]); const getBadges = useCallback(async () => { const language = i18n.language.split("-")[0]; - const params = new URLSearchParams({ - locale: language, - }); + const params = new URLSearchParams({ locale: language }); const badges = await window.electron.hydraApi.get( `/badges?${params.toString()}`, diff --git a/yarn.lock b/yarn.lock index ebd10beb..0337a77b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1047,9 +1047,9 @@ optionalDependencies: global-agent "^3.0.0" -"@electron/node-gyp@git+https://github.com/electron/node-gyp.git#06b29aafb7708acef8b3669835c8a7857ebc92d2": +"@electron/node-gyp@https://github.com/electron/node-gyp#06b29aafb7708acef8b3669835c8a7857ebc92d2": version "10.2.0-electron.1" - resolved "git+https://github.com/electron/node-gyp.git#06b29aafb7708acef8b3669835c8a7857ebc92d2" + resolved "https://github.com/electron/node-gyp#06b29aafb7708acef8b3669835c8a7857ebc92d2" dependencies: env-paths "^2.2.0" exponential-backoff "^3.1.1"