feat(SW-3525): Set correct member type in tracking for partner-sas * Set correct member type in tracking for partner-sas Approved-by: Joakim Jäderberg
37 lines
804 B
TypeScript
37 lines
804 B
TypeScript
import type { Lang } from "@scandic-hotels/common/constants/language"
|
|
import type { User } from "next-auth"
|
|
import type { JWT } from "next-auth/jwt"
|
|
|
|
type Session = {
|
|
token: JWT
|
|
expires: string
|
|
user?: User
|
|
error?: "RefreshAccessTokenError"
|
|
}
|
|
|
|
type CreateContextOptions = {
|
|
auth: () => Promise<Session | null>
|
|
lang: Lang
|
|
pathname: string
|
|
uid?: string | null
|
|
url: string
|
|
webToken?: string
|
|
contentType?: string
|
|
app: "scandic-web" | "partner-sas"
|
|
}
|
|
|
|
export function createContext(opts: CreateContextOptions) {
|
|
return {
|
|
auth: opts.auth,
|
|
lang: opts.lang,
|
|
pathname: opts.pathname,
|
|
uid: opts.uid,
|
|
url: opts.url,
|
|
webToken: opts.webToken,
|
|
contentType: opts.contentType,
|
|
app: opts.app,
|
|
}
|
|
}
|
|
|
|
export type Context = Awaited<ReturnType<typeof createContext>>
|