From 33a9028da953311415c7282eb1eb0b0977a3ddeb Mon Sep 17 00:00:00 2001 From: axolotle Date: Sat, 25 Nov 2023 18:47:45 +0100 Subject: [PATCH] edit: display primary mail adress --- components/UserInfoForm.vue | 11 ++++++++--- locales/en.json | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/components/UserInfoForm.vue b/components/UserInfoForm.vue index b21d19a..282f1ba 100644 --- a/components/UserInfoForm.vue +++ b/components/UserInfoForm.vue @@ -2,7 +2,7 @@ import { useForm } from 'vee-validate' import { toTypedSchema } from '@vee-validate/yup' import * as yup from 'yup' -import { pick } from '@/utils/common' +import { exclude, pick } from '@/utils/common' import type { User } from '@/composables/states' import type { Feedback } from '@/composables/form' @@ -16,12 +16,13 @@ const { handleSubmit, setFieldError, resetForm, meta } = useForm({ validationSchema: toTypedSchema( yup.object({ fullname: yup.string().required().min(2), + mail: yup.string(), mailalias: yup.array().of(yup.string().email().required()).required(), mailforward: yup.array().of(yup.string().email().required()).required(), }), ), initialValues: { - ...pick(user.value, 'fullname', 'mailalias', 'mailforward'), + ...pick(user.value, 'fullname', 'mail', 'mailalias', 'mailforward'), }, }) @@ -43,7 +44,7 @@ const onSubmit = handleSubmit(async (form) => { Pick >('/update', { method: 'PUT', - body: form, + body: exclude(form, 'mail'), }) if (error.value) { @@ -91,6 +92,10 @@ const onSubmit = handleSubmit(async (form) => { /> + + + +