|
@ -1,9 +1,7 @@ |
|
|
import type { ZodSchema } from 'zod'; |
|
|
import type { ZodSchema } from 'zod'; |
|
|
import { z, ZodError } from 'zod'; |
|
|
import { z, ZodError } from 'zod'; |
|
|
import type { H3Event, EventHandlerRequest } from 'h3'; |
|
|
import type { H3Event, EventHandlerRequest } from 'h3'; |
|
|
import { useI18n } from '#i18n'; |
|
|
import { LOCALES } from '~~/i18n.config'; |
|
|
|
|
|
|
|
|
const { availableLocales } = useI18n(); |
|
|
|
|
|
|
|
|
|
|
|
// TODO: use i18n for messages
|
|
|
// TODO: use i18n for messages
|
|
|
|
|
|
|
|
@ -77,8 +75,8 @@ const statistics = z.object( |
|
|
|
|
|
|
|
|
const objectMessage = 'zod.body'; // i18n key
|
|
|
const objectMessage = 'zod.body'; // i18n key
|
|
|
|
|
|
|
|
|
// const langs = LOCALES.map((lang) => lang.value);
|
|
|
const langs = LOCALES.map((lang) => lang.value); |
|
|
const lang = z.enum(['', ...availableLocales]); |
|
|
const lang = z.enum(['', ...langs]); |
|
|
export const langType = z.object({ |
|
|
export const langType = z.object({ |
|
|
lang: lang, |
|
|
lang: lang, |
|
|
}); |
|
|
}); |
|
|