i18n: fixing form validaton messages
This commit is contained in:
@@ -25,7 +25,7 @@ export type State = {
|
||||
*/
|
||||
const FormSchema = (t:IntlTemplateFn) => z.object({
|
||||
_id: z.string(),
|
||||
locationName: z.coerce.string().min(1, t("validation.location-name-required")),
|
||||
locationName: z.coerce.string().min(1, t("location-name-required")),
|
||||
locationNotes: z.string(),
|
||||
})
|
||||
// dont include the _id field in the response
|
||||
@@ -42,7 +42,7 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
|
||||
|
||||
noStore();
|
||||
|
||||
const t = await getTranslations("location-edit-form");
|
||||
const t = await getTranslations("location-edit-form.validation");
|
||||
|
||||
const validatedFields = FormSchema(t).safeParse({
|
||||
locationName: formData.get('locationName'),
|
||||
|
||||
Reference in New Issue
Block a user