From 3f4ad15fa7a07601cd04f3b7b6a602d91c75e71f Mon Sep 17 00:00:00 2001 From: CJewon <112820744+CJewon@users.noreply.github.com> Date: Sun, 20 Apr 2025 16:25:41 +0900 Subject: [PATCH] =?UTF-8?q?:recycle:=20refactor=20:=20=EB=A7=88=EC=9D=B4?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=ED=94=84=EB=A1=9C=ED=95=84=20?= =?UTF-8?q?=EC=82=AC=EC=A7=84=20=EC=B5=9C=EC=A0=81=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/mypage/UserProfileLayout.tsx | 8 ++++- src/context/MypageProvider.tsx | 33 ++++++++++++++------- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/components/mypage/UserProfileLayout.tsx b/src/components/mypage/UserProfileLayout.tsx index 631e377..df24a76 100644 --- a/src/components/mypage/UserProfileLayout.tsx +++ b/src/components/mypage/UserProfileLayout.tsx @@ -28,7 +28,13 @@ export default function UserProfileLayout() { return (
- +

{user.nickname}

diff --git a/src/context/MypageProvider.tsx b/src/context/MypageProvider.tsx index 7978422..47adc59 100644 --- a/src/context/MypageProvider.tsx +++ b/src/context/MypageProvider.tsx @@ -4,18 +4,20 @@ import { useGetUser } from '@/apis/user/queries'; import dayjs, { Dayjs } from 'dayjs'; import { useGetMonthlyEmotionLogs } from '@/apis/emotion-log/queries'; +const defaultUser = { + image: process.env.NEXT_PUBLIC_DEFAULT_IMAGE_URL ?? '', + createdAt: '', + updatedAt: '', + teamId: '', + nickname: '사용자', + id: 0, +}; + export const MypageContext = createContext({ currentDate: dayjs(), setCurrentDate: () => {}, userEmotion: [], - user: { - image: '', - createdAt: '', - updatedAt: '', - teamId: '', - nickname: '', - id: 0, - }, + user: defaultUser, }); export default function MypageProvider({ children }: PropsWithChildren) { @@ -32,7 +34,16 @@ export default function MypageProvider({ children }: PropsWithChildren) { enabled: !!user && !!currentDate, }); - if (!user || !userEmotion) return
로딩 중...
; - - return {children}; + return ( + + {children} + + ); }