- {data.zipCode.split('').map((code, index) => (
+ {myInfo?.zipCode.split('').map((code, index) => (
{
-
{description}
- {data.temperature}도
+
+ {getDescriptionByTemperature(Number(myInfo?.temperature))}
+
+ {myInfo?.temperature}도
@@ -131,8 +135,8 @@ const MyPage = () => {
로그인 정보
- {data.social}
- {data.email}
+ {myInfo?.social}
+ {myInfo?.email}
{
>
경고 횟수
- {data.warningCount}회
+ {myInfo?.warningCount}회
diff --git a/src/stores/myPageStore.ts b/src/stores/myPageStore.ts
deleted file mode 100644
index dda344e..0000000
--- a/src/stores/myPageStore.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-import { create } from 'zustand';
-
-import { fetchMyPageInfo } from '@/apis/myPage';
-
-interface MyPageDataStore {
- zipCode: string;
- temperature: string;
- social: string;
- email: string;
- warningCount: number;
-}
-
-interface MyPageStore {
- data: MyPageDataStore;
- message: string;
- setMyPageData: (newData: MyPageDataStore) => void;
- fetchMyPageInfo: () => void;
-}
-const useMyPageStore = create((set) => ({
- data: {
- zipCode: '',
- temperature: '',
- social: '',
- email: '',
- warningCount: 0,
- },
- message: '',
- setMyPageData: (newData) => set({ data: newData }),
- fetchMyPageInfo: async () => {
- try {
- const responseData = await fetchMyPageInfo();
- set({ data: responseData.data, message: responseData.message });
- } catch (error) {
- console.error('데이터를 불러오던 중 에러가 발생했습니다', error);
- }
- },
-}));
-
-export default useMyPageStore;
diff --git a/src/types/mypage.d.ts b/src/types/mypage.d.ts
new file mode 100644
index 0000000..f70b9a1
--- /dev/null
+++ b/src/types/mypage.d.ts
@@ -0,0 +1,7 @@
+interface MyPage {
+ zipCode: string;
+ temperature: string;
+ social: string;
+ email: string;
+ warningCount: number;
+}
-
{description}
-{data.temperature}도
++ {getDescriptionByTemperature(Number(myInfo?.temperature))} +
+{myInfo?.temperature}도
로그인 정보
- {data.social} - {data.email} + {myInfo?.social} + {myInfo?.email}
경고 횟수
- {data.warningCount}회 + {myInfo?.warningCount}회