From d72acdceebf6e6824f025279d036b0b6f1155ea9 Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Sun, 2 Nov 2025 15:57:12 +0900 Subject: (김준회) 미사용 코드베이스 스키마 제거(SWP), signout console 추가 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/auth/custom-signout.ts | 78 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 72 insertions(+), 6 deletions(-) (limited to 'lib/auth/custom-signout.ts') diff --git a/lib/auth/custom-signout.ts b/lib/auth/custom-signout.ts index d59bd81c..6f3a6b01 100644 --- a/lib/auth/custom-signout.ts +++ b/lib/auth/custom-signout.ts @@ -11,19 +11,28 @@ interface CustomSignOutOptions { /** * 커스텀 로그아웃 함수 * - * @param options - callbackUrl: 로그아웃 후 이동할 URL (기본: 현재 origin + "/") + * @param options - callbackUrl: 로그아웃 후 이동할 URL (상대 경로 권장: "/ko/partners") * @param options - redirect: 자동 리다이렉트 여부 (기본: true) */ export async function customSignOut(options?: CustomSignOutOptions): Promise { const { callbackUrl, redirect = true } = options || {}; + console.log('[customSignOut] 시작:', { + currentOrigin: window.location.origin, + currentHref: window.location.href, + callbackUrl, + redirect, + }); + try { // 1. CSRF 토큰 가져오기 const csrfResponse = await fetch('/api/auth/csrf'); const { csrfToken } = await csrfResponse.json(); - // 2. 서버에 로그아웃 요청 - await fetch('/api/auth/signout', { + console.log('[customSignOut] CSRF 토큰 획득'); + + // 2. 서버에 로그아웃 요청 (리다이렉트 방지) + const signoutResponse = await fetch('/api/auth/signout', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded', @@ -32,18 +41,75 @@ export async function customSignOut(options?: CustomSignOutOptions): Promise