diff --git a/src/hooks/use-auth/use-auth-login/index.ts b/src/hooks/use-auth/use-auth-login/index.ts index 2ca65279..31e9c4d3 100644 --- a/src/hooks/use-auth/use-auth-login/index.ts +++ b/src/hooks/use-auth/use-auth-login/index.ts @@ -54,9 +54,9 @@ export const useLogin = () => { const [loginError, setLoginError] = useState(null); const clearLoginError = useCallback(() => setLoginError(null), []); - const { setIsAuthenticated: _ } = useAuth(); + const { setIsAuthenticated } = useAuth(); - const handleLogin = async (payload: LoginRequest, _formApi: { reset: () => void }) => { + const handleLogin = async (payload: LoginRequest, formApi: { reset: () => void }) => { setLoginError(null); try { @@ -70,27 +70,12 @@ export const useLogin = () => { secure: process.env.NODE_ENV === 'production', }); - // formApi.reset(); + formApi.reset(); - // setIsAuthenticated(true); + setIsAuthenticated(true); const nextPath = normalizePath(searchParams.get('path')); - // window.location.href = nextPath; - - console.log('[DEBUG] ========== Navigation Info =========='); - console.log('[DEBUG] window.location.href:', window.location.href); - console.log('[DEBUG] window.location.pathname:', window.location.pathname); - console.log('[DEBUG] window.location.search:', window.location.search); - console.log('[DEBUG] searchParams.get("path"):', searchParams.get('path')); - console.log('[DEBUG] nextPath:', nextPath); - console.log('[DEBUG] Same pathname?', window.location.pathname === nextPath); - console.log('[DEBUG] ====================================='); - try { - router.replace(nextPath); - console.log('[LOGIN] router.replace called successfully'); - } catch (e) { - console.error('[LOGIN] router.replace threw error:', e); - } + router.replace(nextPath); } catch (error) { if (isCommonErrorResponse(error)) { console.error('[LOGIN ERROR]', error.errorCode, error.detail); diff --git a/src/proxy.ts b/src/proxy.ts index b481f087..a3e5ad94 100644 --- a/src/proxy.ts +++ b/src/proxy.ts @@ -1,7 +1,7 @@ import { NextRequest, NextResponse } from 'next/server'; export default async function proxy(request: NextRequest) { - const accessToken = request.cookies.get('accessToken'); + // const accessToken = request.cookies.get('accessToken'); const refreshToken = request.cookies.get('refreshToken'); const protectedPaths = ['/mypage', '/create-group', '/message', '/schedule', '/notification']; @@ -13,7 +13,7 @@ export default async function proxy(request: NextRequest) { } // 둘 다 없으면 로그인 페이지로 redirect - if (!accessToken && !refreshToken) { + if (!refreshToken) { const loginUrl = new URL('/login', request.url); loginUrl.searchParams.set('error', 'unauthorized'); loginUrl.searchParams.set('path', request.nextUrl.pathname);