diff --git a/apps/cs/app/api/auth/logout/route.ts b/apps/cs/app/api/auth/logout/route.ts deleted file mode 100644 index fdcc9df7c..000000000 --- a/apps/cs/app/api/auth/logout/route.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { cookies } from "next/headers"; -import { NextResponse } from "next/server"; -import { - ACCESS_TOKEN, - AUTH_USER_ID, - CLAIM_NAME, - REFRESH_TOKEN, -} from "@/shared/config"; - -export async function POST() { - const cookieStore = await cookies(); - cookieStore.delete(ACCESS_TOKEN); - cookieStore.delete(REFRESH_TOKEN); - cookieStore.delete(AUTH_USER_ID); - cookieStore.delete(CLAIM_NAME); - return NextResponse.json({ message: "Logged out" }, { status: 200 }); -} diff --git a/apps/cs/src/entities/auth/api/auth-service.ts b/apps/cs/src/entities/auth/api/auth-service.ts index a94ae9541..3efb1bf85 100644 --- a/apps/cs/src/entities/auth/api/auth-service.ts +++ b/apps/cs/src/entities/auth/api/auth-service.ts @@ -1,6 +1,5 @@ import { ACCESS_TOKEN, - AUTH_LOGIN_REDIRECT_URL, AUTH_USER_ID, CLAIM_NAME, ENDPOINT, @@ -105,22 +104,12 @@ async function silentRefresh(): Promise { } async function logout(): Promise { - try { - await fetch("/api/auth/logout", { - method: "POST", - credentials: "include", - }); - } catch (error) { - console.error("Logout API failed:", error); - } - tokenManager.clearAuthToken(); removeToken("site-id-key"); removeToken("site-theme-key"); if (typeof window !== "undefined") { window.dispatchEvent(new CustomEvent("auth:logout")); - window.location.href = AUTH_LOGIN_REDIRECT_URL; } }