Skip to content

Commit

Permalink
fix: useGetUserProfile 훅 초기값 변경 및 조건문 수정 (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
yeonddori authored Jul 21, 2024
1 parent 04c67ca commit d34a8f3
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 d34a8f3

Please sign in to comment.