From 9e9cdc764bd59d5af3bec460a68f038daaa64951 Mon Sep 17 00:00:00 2001 From: sjsjsj1246 Date: Wed, 25 Sep 2024 13:20:35 +0900 Subject: [PATCH] =?UTF-8?q?hotfix:=20accessToken=20=EB=AF=B8=EC=A0=84?= =?UTF-8?q?=EB=8B=AC=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/auth/useAuth/index.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/hooks/auth/useAuth/index.ts b/src/hooks/auth/useAuth/index.ts index 447f3a79..120fcd9c 100644 --- a/src/hooks/auth/useAuth/index.ts +++ b/src/hooks/auth/useAuth/index.ts @@ -1,6 +1,6 @@ import { shallow } from 'zustand/shallow'; import useAuthStore from './store'; -import axiosInstance from '@libs/api/client'; +import axiosInstance, { setAccessToken } from '@libs/api/client'; import { demoStart, getAccountMe } from '@libs/api/auth'; import { useLocation, useNavigate } from 'react-router'; import ROUTE from '@libs/constant/path'; @@ -87,6 +87,12 @@ const useAuth = (activeEffect = false) => { setState('isAuth', true); }; + useEffect(() => { + if (accessToken) { + setAccessToken(accessToken); + } + }, [accessToken]); + useEffect(() => { if (_loaded && activeEffect) { if (demoStartDate && new Date(demoStartDate).getTime() + 3540000 - new Date().getTime() <= 0)