From 71f0d4cdac261c26c223d3ec1318526aae1f6551 Mon Sep 17 00:00:00 2001 From: keemsebeen Date: Mon, 9 Sep 2024 20:00:53 +0900 Subject: [PATCH] =?UTF-8?q?hotfix=20:=20admin=ED=8E=98=EC=9D=B4=EC=A7=80?= =?UTF-8?q?=20refresh=5Ftoken,=20access=5Ftoken=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/admin/index.tsx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/pages/admin/index.tsx b/src/pages/admin/index.tsx index 4b467bdf..8a58aab3 100644 --- a/src/pages/admin/index.tsx +++ b/src/pages/admin/index.tsx @@ -16,6 +16,21 @@ export default function Index() { const { data: noticedata } = useAllNotices(); const { data: documentData } = useAllDocuments(); const [infoElement, setInfoElement] = useState(<>); + const [cookies, setCookie, removeCookie] = useCookies([ + 'access_token', + 'refresh_token', + ]); + + const removeTokens = () => { + removeCookie('refresh_token'); + removeCookie('access_token'); + }; + + useEffect(() => { + if (cookies.refresh_token || cookies.access_token) { + removeTokens(); + } + }, [cookies.refresh_token, cookies.access_token, removeTokens]); const notices = noticedata?.data.sort((a, b) => { return b.id - a.id;