mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-03-26 17:51:54 +01:00
Fix logout (#536)
This commit is contained in:
parent
478fb4f999
commit
d09c320538
@ -1,9 +1,14 @@
|
||||
import { getDomain } from "@/lib/redirectSS";
|
||||
import { getAuthTypeSS, logoutSS } from "@/lib/userSS";
|
||||
import { NextRequest } from "next/server";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
export const POST = async (request: NextRequest) => {
|
||||
// Directs the logout request to the appropriate FastAPI endpoint.
|
||||
// Needed since env variables don't work well on the client-side
|
||||
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 });
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user