From 179f933ac6b5afcaaf1246d7c6edfe292dace247 Mon Sep 17 00:00:00 2001 From: bottlewook Date: Thu, 29 Feb 2024 19:19:42 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=BF=BC=EB=A6=AC=ED=9B=85=20=EC=BF=A0?= =?UTF-8?q?=ED=82=A4=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useLoggedOut.ts | 5 +---- src/remote/queries/auth/useLogin.ts | 7 ++----- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/hooks/useLoggedOut.ts b/src/hooks/useLoggedOut.ts index ddc83f6a..e28a0d83 100644 --- a/src/hooks/useLoggedOut.ts +++ b/src/hooks/useLoggedOut.ts @@ -1,17 +1,14 @@ -import { useCookies } from 'react-cookie'; - import { useQueryClient } from '@tanstack/react-query'; import { useRouter } from 'next/navigation'; import { useAppDispatch } from '@stores/hooks'; import { clearUserId } from '@stores/slices/userSlice'; +import { removeCookie } from '@utils/cookies'; function useLoggedOut() { const router = useRouter(); const dispatch = useAppDispatch(); const query = useQueryClient(); - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const [cookies, removeCookie] = useCookies(['token']); const logout = (redirectPath = '/') => { dispatch(clearUserId()); diff --git a/src/remote/queries/auth/useLogin.ts b/src/remote/queries/auth/useLogin.ts index 60079703..12d9fd1f 100644 --- a/src/remote/queries/auth/useLogin.ts +++ b/src/remote/queries/auth/useLogin.ts @@ -1,5 +1,3 @@ -import { useCookies } from 'react-cookie'; - import { useMutation } from '@tanstack/react-query'; import { useRouter } from 'next/navigation'; @@ -7,14 +5,13 @@ import { login } from '@remote/api/requests/auth/auth.post.api'; import { UserInfoType } from '@remote/api/types/auth'; import { useAppDispatch } from '@stores/hooks'; import { setUserId } from '@stores/slices/userSlice'; +import { setCookie } from '@utils/cookies'; function useLogin() { const router = useRouter(); const dispatch = useAppDispatch(); - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const [cookies, setCookie] = useCookies(['token']); - const onSuccess = (data : UserInfoType) => { + const onSuccess = (data: UserInfoType) => { const { id, jwtToken } = data.value; const cookieOptions = { path: '/', maxAge: 60 * 15 };