Files
web/apps/scandic-web/services/warmup/warmupHotelData.ts
Matilda Landström 5986828580 Merged in feat/LOY-430-reward-nights (pull request #3295)
Feat/LOY-430 reward nights

* chore(LOY-430): add reward nights request and dynamic content

* chore(LOY-430): fix Reward Night component

* Refactor: use existing endpoint and add rewardNight data to that response instead


Approved-by: Linus Flood
2025-12-08 07:44:58 +00:00

34 lines
713 B
TypeScript

import { env } from "@/env/server"
import { serverClient } from "@/lib/trpc/server"
import type { Lang } from "@scandic-hotels/common/constants/language"
import type { WarmupFunction, WarmupResult } from "."
export const warmupHotelData =
(lang: Lang): WarmupFunction =>
async (): Promise<WarmupResult> => {
if (!env.ENABLE_WARMUP_HOTEL) {
return {
status: "skipped",
}
}
try {
const caller = await serverClient()
await caller.hotel.hotels.getAllHotelData({
lang,
warmup: true,
})
} catch (error) {
return {
status: "error",
error: error as Error,
}
}
return {
status: "completed",
}
}