diff --git a/src/apis/fetchAlarm.ts b/src/apis/fetchAlarm.ts index 83d85eac..328be167 100644 --- a/src/apis/fetchAlarm.ts +++ b/src/apis/fetchAlarm.ts @@ -1,8 +1,8 @@ import { END_POINTS } from "@constants/api"; -import axios from "axios"; import { AlarmType } from "@type/alarm"; +import { axiosInstance } from "./axiosInstance"; export const fetchAlarm = async (): Promise => { - const { data } = await axios.get(END_POINTS.ALARM); + const { data } = await axiosInstance.get(END_POINTS.ALARM); return data.data; }; diff --git a/src/apis/fetchHasAlarm.ts b/src/apis/fetchHasAlarm.ts index eaa043f5..c809c3e3 100644 --- a/src/apis/fetchHasAlarm.ts +++ b/src/apis/fetchHasAlarm.ts @@ -3,15 +3,19 @@ import { ReadType } from "@type/alarm"; import { isAccessTokenExpired } from "@utils/checkToken"; import axios from "axios"; -export const fetchHasAlarm = async (): Promise => { +export const fetchHasAlarm = async (): Promise => { const accessToken = localStorage.getItem("accessToken"); if (!accessToken) { - return []; + return { + hasNonReadAlarm: false, + }; } if (isAccessTokenExpired(accessToken)) { console.log("expired Token"); - return []; + return { + hasNonReadAlarm: false, + }; } const { data } = await axios.get(BASE_URL + END_POINTS.HASALARM, { diff --git a/src/pages/alarmPage/AlarmPage.style.ts b/src/pages/alarmPage/AlarmPage.style.ts index afbcf431..d5c2049d 100644 --- a/src/pages/alarmPage/AlarmPage.style.ts +++ b/src/pages/alarmPage/AlarmPage.style.ts @@ -4,7 +4,7 @@ export const Container = styled.section` width: 100%; height: 100%; - padding: 56px 1.25rem 80px; + padding: 56px 0 80px; background-color: white; `; diff --git a/src/pages/alarmPage/AlarmPage.tsx b/src/pages/alarmPage/AlarmPage.tsx index 418f7ee9..26acc7e0 100644 --- a/src/pages/alarmPage/AlarmPage.tsx +++ b/src/pages/alarmPage/AlarmPage.tsx @@ -20,7 +20,7 @@ const AlarmPage = () => { }); if (isLoading) { - return ; + return ; } return ( @@ -28,10 +28,8 @@ const AlarmPage = () => { {alarmData?.map((item) => item.isRead ? ( - -

{item.content}

-

{format(parseISO(item.date), "yyyy. MM. dd. HH:mm")}

-
+

{item.content}

+

{format(parseISO(item.date), "yyyy. MM. dd. HH:mm")}

) : ( @@ -43,7 +41,7 @@ const AlarmPage = () => { ), )} - {!alarmData && ( + {alarmData && alarmData.length === 0 && ( {
- +