refactor(SW-188): replace anon or auth procedure with serviceProcedure
This commit is contained in:
@@ -5,3 +5,24 @@ import { Lang } from "@/constants/languages"
|
||||
export const langInput = z.object({
|
||||
lang: z.nativeEnum(Lang),
|
||||
})
|
||||
|
||||
/**
|
||||
* Helper function to convert Lang enum to uppercase
|
||||
* Needed for the Hotel endpoint.
|
||||
*/
|
||||
export const toApiLang = (lang: Lang): string => {
|
||||
const result = toApiLangMap[lang]
|
||||
if (!result) {
|
||||
throw new Error("Invalid language")
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
const toApiLangMap: { [key in Lang]: string } = {
|
||||
[Lang.en]: "En",
|
||||
[Lang.sv]: "Sv",
|
||||
[Lang.no]: "No",
|
||||
[Lang.fi]: "Fi",
|
||||
[Lang.da]: "Da",
|
||||
[Lang.de]: "De",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user