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
24 lines
597 B
TypeScript
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
|
|
}
|