Files
web/packages/trpc/lib/context.ts
Anton Gunnarsson a5759205ec Merged in feat/sw-3525-sas-member-type-in-tracking (pull request #2931)
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
2025-10-09 12:47:38 +00:00

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>>