From d34a8f3fba4fe0fb10811770dd9a443b8f82011b Mon Sep 17 00:00:00 2001 From: yeonddori <126975394+yeonddori@users.noreply.github.com> Date: Mon, 22 Jul 2024 01:36:59 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20useGetUserProfile=20=ED=9B=85=20?= =?UTF-8?q?=EC=B4=88=EA=B8=B0=EA=B0=92=20=EB=B3=80=EA=B2=BD=20=EB=B0=8F=20?= =?UTF-8?q?=EC=A1=B0=EA=B1=B4=EB=AC=B8=20=EC=88=98=EC=A0=95=20(#119)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #116 --- src/hooks/useGetUser.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/hooks/useGetUser.ts b/src/hooks/useGetUser.ts index e2d2031..cd1ea7c 100644 --- a/src/hooks/useGetUser.ts +++ b/src/hooks/useGetUser.ts @@ -12,11 +12,16 @@ export const useGetUser = () => { export const useGetUserProfile = () => { const user = useGetUser(); const userProfile = useAtomValue(userProfileAtom); - const [result, setResult] = useState<{ name: string; profileImage: string } | null>(null); + + const [result, setResult] = useState<{ name: string; profileImage: string } | null>( + userProfile.name === '' && userProfile.profileImage === '' ? null : userProfile, + ); useEffect(() => { if (user.isLogin) { setResult(userProfile); + } else { + setResult(null); } }, [user, userProfile]);