From 5c0512f805c48abf29857beea512f682d7f41373 Mon Sep 17 00:00:00 2001 From: bottlewook Date: Thu, 29 Feb 2024 19:20:24 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=BF=A0=ED=82=A4=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD=20#230?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/my-page/page.tsx | 10 +++++----- src/remote/api/common.api.ts | 10 ++++------ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/app/my-page/page.tsx b/src/app/my-page/page.tsx index 9302c5db..8333d1c6 100644 --- a/src/app/my-page/page.tsx +++ b/src/app/my-page/page.tsx @@ -20,6 +20,9 @@ import styles from './page.module.scss'; const cx = classNames.bind(styles); +const TOP_MARGIN = 96; +const BOTTOM_MARGIN = 97; + function MyProfilePage() { // eslint-disable-next-line @typescript-eslint/no-unused-vars const [cookies, removeCookie] = useCookies(['token']); @@ -40,9 +43,6 @@ function MyProfilePage() { logout(); }; - const topMargin = 96; - const bottomMargin = 97; - if (isLoggedIn === false) { return ( <> @@ -50,8 +50,8 @@ function MyProfilePage() { title={REQUIRED_LOGIN.title} description={REQUIRED_LOGIN.description} options={REQUIRED_LOGIN.options} - topMargin={topMargin} - bottomMargin={bottomMargin} + topMargin={TOP_MARGIN} + bottomMargin={BOTTOM_MARGIN} /> diff --git a/src/remote/api/common.api.ts b/src/remote/api/common.api.ts index f3922d19..21d575fa 100644 --- a/src/remote/api/common.api.ts +++ b/src/remote/api/common.api.ts @@ -1,9 +1,9 @@ /* eslint-disable no-param-reassign */ -import { useCookies } from 'react-cookie'; import axios, { InternalAxiosRequestConfig, AxiosError, AxiosResponse } from 'axios'; import { axiosInstance } from '@remote/api/instance.api'; +import { getCookie } from '@utils/cookies'; import logOnDev from '@utils/logOnDev'; axiosInstance.interceptors.request.use( @@ -12,11 +12,9 @@ axiosInstance.interceptors.request.use( * request 직전 공통으로 진행할 작업 */ if (config && config.headers) { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const [cookies, setCookie] = useCookies(['token']); - - if (cookies.token) { - config.headers.Authorization = cookies.token as string; + const token = getCookie('token') as string; + if (token) { + config.headers.Authorization = token; config.headers['Content-Type'] = 'application/json'; } }