mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-07-09 14:11:33 +02:00
Fix logout (#536)
This commit is contained in:
@ -1,9 +1,14 @@
|
|||||||
|
import { getDomain } from "@/lib/redirectSS";
|
||||||
import { getAuthTypeSS, logoutSS } from "@/lib/userSS";
|
import { getAuthTypeSS, logoutSS } from "@/lib/userSS";
|
||||||
import { NextRequest } from "next/server";
|
import { NextRequest, NextResponse } from "next/server";
|
||||||
|
|
||||||
export const POST = async (request: NextRequest) => {
|
export const POST = async (request: NextRequest) => {
|
||||||
// Directs the logout request to the appropriate FastAPI endpoint.
|
// Directs the logout request to the appropriate FastAPI endpoint.
|
||||||
// Needed since env variables don't work well on the client-side
|
// Needed since env variables don't work well on the client-side
|
||||||
const authType = await getAuthTypeSS();
|
const authType = await getAuthTypeSS();
|
||||||
return await logoutSS(authType, request.headers);
|
const response = await logoutSS(authType, request.headers);
|
||||||
|
if (response && response.ok) {
|
||||||
|
return NextResponse.redirect(new URL("/auth/login", getDomain(request)));
|
||||||
|
}
|
||||||
|
return new Response(null, { status: 204 });
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user