diff --git a/app/[lang]/(live)/(protected)/logout/route.ts b/app/[lang]/(live)/(protected)/logout/route.ts index 003602043..19587478c 100644 --- a/app/[lang]/(live)/(protected)/logout/route.ts +++ b/app/[lang]/(live)/(protected)/logout/route.ts @@ -53,7 +53,7 @@ export async function GET( const invalidateResponse = await serverClient().user.invalidateSessions() let redirectUrlValue - console.log(context.params.lang) + switch (context.params.lang) { case Lang.da: redirectUrlValue = env.SEAMLESS_LOGOUT_DA @@ -74,7 +74,7 @@ export async function GET( redirectUrlValue = env.SEAMLESS_LOGOUT_SV break } - + console.log(redirectUrlValue) const redirectUrl = new URL(redirectUrlValue) redirectUrl.searchParams.set("returnurl", redirectTo) redirectTo = redirectUrl.toString() @@ -104,15 +104,15 @@ export async function GET( process.env ) - console.log({ logout_signInURL: signOutURL }) + console.log({ logout_signOutURL: signOutURL }) - const redirectUrl = await signOut({ + const redirectUrlObj = await signOut({ redirectTo, redirect: false, }) - - if (redirectUrl) { - return NextResponse.redirect(redirectUrl, { + console.log(redirectUrlObj) + if (redirectUrlObj) { + return NextResponse.redirect(redirectUrlObj.redirect, { headers: redirectHeaders, }) }