From ffb7422fa0ef59742c1082d1125bfe27541c2d12 Mon Sep 17 00:00:00 2001 From: yeonddori Date: Mon, 22 Jul 2024 01:27:48 +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?= 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]);