diff --git a/src/hooks/use-auth/use-auth-login/index.ts b/src/hooks/use-auth/use-auth-login/index.ts index 35e004f5..31e9c4d3 100644 --- a/src/hooks/use-auth/use-auth-login/index.ts +++ b/src/hooks/use-auth/use-auth-login/index.ts @@ -75,9 +75,7 @@ export const useLogin = () => { setIsAuthenticated(true); const nextPath = normalizePath(searchParams.get('path')); - // router.refresh(); - // router.replace(nextPath); - router.push(nextPath); + 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 deleted file mode 100644 index a3e5ad94..00000000 --- a/src/proxy.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { NextRequest, NextResponse } from 'next/server'; - -export default async function proxy(request: NextRequest) { - // const accessToken = request.cookies.get('accessToken'); - const refreshToken = request.cookies.get('refreshToken'); - - const protectedPaths = ['/mypage', '/create-group', '/message', '/schedule', '/notification']; - const isProtected = protectedPaths.some((path) => request.nextUrl.pathname.startsWith(path)); - - // 보호되지 않은 경로는 그냥 통과 - if (!isProtected) { - return NextResponse.next(); - } - - // 둘 다 없으면 로그인 페이지로 redirect - if (!refreshToken) { - const loginUrl = new URL('/login', request.url); - loginUrl.searchParams.set('error', 'unauthorized'); - loginUrl.searchParams.set('path', request.nextUrl.pathname); - return NextResponse.redirect(loginUrl); - } - - return NextResponse.next(); -} - -export const config = { - matcher: ['/((?!api|_next/static|_next/image|favicon.ico|login|signup).*)'], -};