Files
web/packages/trpc/lib/utils/getRedemptionTokenSafely.ts
Hrishikesh Vaipurkar 78ede453a2 Merged in feat/SW-3526-show-sas-eb-points-rate-in- (pull request #2933)
feat(SW-3526): Show EB points rate and label in booking flow

* feat(SW-3526): Show EB points rate and label in booking flow

* feat(SW-3526) Optimized points currency code

* feat(SW-3526) Removed extra multiplication for token expiry after rebase

* feat(SW-3526): Updated to exhaustive check and thow if type error

Approved-by: Anton Gunnarsson
2025-10-15 06:54:44 +00:00

24 lines
597 B
TypeScript

import { isValidSession } from "./session"
import type { Session } from "next-auth"
export function getRedemptionTokenSafely(
session: Session,
serviceToken: string
): string | undefined {
if (!isValidSession(session)) return undefined
// ToDo- Get Curity based token when linked user is logged in
// const token =
// session.token.loginType === "sas"
// ? session.token.curity_access_token ?? serviceToken
// : session.token.access_token
const token =
session.token.loginType === "sas"
? serviceToken
: session.token.access_token
return token
}