fix(SW-188): remove refine and validate on transform for hotel schema

This commit is contained in:
Chuma McPhoy
2024-08-19 10:40:03 +02:00
parent 16e0165a6e
commit 172802af2f

View File

@@ -421,12 +421,7 @@ export const getHotelDataSchema = z.object({
data: z.object({ data: z.object({
id: z.string(), id: z.string(),
type: z.string(), // No enum here but the standard return appears to be "hotels". type: z.string(), // No enum here but the standard return appears to be "hotels".
language: z language: z.string().transform((val) => {
.string()
.refine((val) => toLang(val) !== undefined, {
message: "Invalid language",
})
.transform((val) => {
const lang = toLang(val) const lang = toLang(val)
if (!lang) { if (!lang) {
throw new Error("Invalid language") throw new Error("Invalid language")