From a4a83df054288465d9f4ec14dcec76759606b499 Mon Sep 17 00:00:00 2001 From: DOBOB_LAPTOP Date: Mon, 13 Nov 2023 21:14:09 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20auth=20=EA=B4=80=EB=A0=A8=20remote?= =?UTF-8?q?=ED=95=A8=EC=88=98=20auth/=ED=95=98=EC=9C=84=EB=A1=9C=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/features/auth/remotes/{login.ts => auth.ts} | 9 +++++++-- frontend/src/pages/AuthPage.tsx | 2 +- frontend/src/shared/remotes/auth.ts | 11 ----------- 3 files changed, 8 insertions(+), 14 deletions(-) rename frontend/src/features/auth/remotes/{login.ts => auth.ts} (55%) delete mode 100644 frontend/src/shared/remotes/auth.ts diff --git a/frontend/src/features/auth/remotes/login.ts b/frontend/src/features/auth/remotes/auth.ts similarity index 55% rename from frontend/src/features/auth/remotes/login.ts rename to frontend/src/features/auth/remotes/auth.ts index fe1298fd..04e98290 100644 --- a/frontend/src/features/auth/remotes/login.ts +++ b/frontend/src/features/auth/remotes/auth.ts @@ -1,5 +1,4 @@ -import { client } from '@/shared/remotes/axios'; - +import { client, clientBasic } from '@/shared/remotes/axios'; interface AccessTokenRes { accessToken: string; } @@ -11,3 +10,9 @@ export const getAccessToken = async (platform: string, code: string) => { return data; }; + +export const postRefreshAccessToken = async () => { + const { data } = await clientBasic.post('/reissue'); + + return data; +}; diff --git a/frontend/src/pages/AuthPage.tsx b/frontend/src/pages/AuthPage.tsx index 7ab3225b..71cdea3e 100644 --- a/frontend/src/pages/AuthPage.tsx +++ b/frontend/src/pages/AuthPage.tsx @@ -1,7 +1,7 @@ import { useEffect } from 'react'; import { Navigate, useNavigate, useSearchParams } from 'react-router-dom'; import { useAuthContext } from '@/features/auth/components/AuthProvider'; -import { getAccessToken } from '@/features/auth/remotes/login'; +import { getAccessToken } from '@/features/auth/remotes/auth'; import path from '@/shared/constants/path'; import useValidParams from '@/shared/hooks/useValidParams'; import accessTokenStorage from '@/shared/utils/accessTokenStorage'; diff --git a/frontend/src/shared/remotes/auth.ts b/frontend/src/shared/remotes/auth.ts deleted file mode 100644 index 8c28ab39..00000000 --- a/frontend/src/shared/remotes/auth.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { clientBasic } from './axios'; - -interface RefreshAccessTokenRes { - accessToken: string; -} - -export const postRefreshAccessToken = async (staleAccessToken: string) => { - const { data } = await clientBasic.post('/reissue', staleAccessToken); - - return data; -};