fix(SW-3549): update social session management functions for clarity and consistency * refactor(SW-3549): rename session management functions for clarity and consistency * merge Approved-by: Hrishikesh Vaipurkar
24 lines
643 B
TypeScript
24 lines
643 B
TypeScript
import { type NextRequest, NextResponse } from "next/server"
|
|
|
|
import { getPublicURL } from "@/server/utils"
|
|
|
|
import { signOut } from "@/auth"
|
|
import { destroySocialSession } from "@/auth/scandic/session"
|
|
|
|
import type { Lang } from "@scandic-hotels/common/constants/language"
|
|
|
|
export async function GET(
|
|
request: NextRequest,
|
|
_context: { params: Promise<{ lang: Lang }> }
|
|
) {
|
|
const publicURL = getPublicURL(request)
|
|
|
|
const redirectTo: string = publicURL
|
|
await signOut({ redirectTo, redirect: false })
|
|
|
|
// Delete scandic session once user logouts from sas
|
|
await destroySocialSession()
|
|
|
|
return NextResponse.redirect(redirectTo)
|
|
}
|