fix: webview - mystay - check if we have webviewToken * fix: webview - mystay - check if we have webviewToken * Cleanup Approved-by: Joakim Jäderberg
17 lines
449 B
TypeScript
17 lines
449 B
TypeScript
import "server-only"
|
|
|
|
import { cookies } from "next/headers"
|
|
|
|
import { auth } from "@/auth"
|
|
|
|
import { isValidSession } from "./session"
|
|
|
|
export async function isLoggedInUser(): Promise<boolean> {
|
|
const session = await auth()
|
|
const cookie = cookies()
|
|
const webviewTokenCookie = cookie.get("webviewToken")
|
|
|
|
// We assume we have a valid session if we have a webviewTokenCookie.
|
|
return isValidSession(session) || !!webviewTokenCookie?.value
|
|
}
|