Skip to content

Commit

Permalink
fix: useGetUserProfile 훅 초기값 변경 및 조건문 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
yeonddori committed Jul 21, 2024
1 parent 3fd8bb7 commit ffb7422
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/hooks/useGetUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Expand Down

0 comments on commit ffb7422

Please sign in to comment.