feat(SW-3611): Add config flag for saved credit cards * Add config flag for saved credit cards Approved-by: Linus Flood
21 lines
593 B
TypeScript
21 lines
593 B
TypeScript
import { cache } from "react"
|
|
|
|
import { getBookingFlowConfig } from "../../bookingFlowConfig/bookingFlowConfig"
|
|
import { serverClient } from "../../trpc"
|
|
|
|
import type { GetSavedPaymentCardsInput } from "@scandic-hotels/trpc/routers/user/input"
|
|
|
|
export const getSavedPaymentCardsSafely = cache(
|
|
async function getMemoizedSavedPaymentCardsSafely(
|
|
input: GetSavedPaymentCardsInput
|
|
) {
|
|
const config = getBookingFlowConfig()
|
|
if (!config.savedCreditCardsEnabled) {
|
|
return null
|
|
}
|
|
|
|
const caller = await serverClient()
|
|
return caller.user.safePaymentCards(input)
|
|
}
|
|
)
|