mirror of
https://github.com/YunoHost/yunohost-portal.git
synced 2024-09-03 20:06:23 +02:00
add i1_n keys + add global error message on edit form
This commit is contained in:
parent
f10a8063f7
commit
fd95f788c9
3 changed files with 16 additions and 7 deletions
|
@ -5,8 +5,9 @@ const props = defineProps<{
|
|||
name: string
|
||||
label: string
|
||||
inputLabel: string
|
||||
buttonLabel: string
|
||||
type: HTMLInputElement['type']
|
||||
placeholder?: string
|
||||
placeholder?: string,
|
||||
}>()
|
||||
|
||||
const group: Ref<HTMLElement | null> = ref(null)
|
||||
|
@ -55,6 +56,6 @@ function onAdd() {
|
|||
</div>
|
||||
</FormField>
|
||||
|
||||
<YButton :text="$t('add')" @click="onAdd" />
|
||||
<YButton :text="buttonLabel" @click="onAdd" />
|
||||
</fieldset>
|
||||
</template>
|
||||
|
|
|
@ -54,6 +54,8 @@
|
|||
"footerlink_documentation": "Documentation",
|
||||
"footerlink_support": "Support",
|
||||
"footerlink_administration": "Administration",
|
||||
"remove": "Remove",
|
||||
"save": "Save",
|
||||
"skip_to_main_content": "Skip to main content",
|
||||
"v": {
|
||||
"field_invalid": "Field value is invalid",
|
||||
|
|
|
@ -78,14 +78,18 @@ const onSubmit = handleSubmit(async (form) => {
|
|||
// Reset form dirty state but keep previous values
|
||||
resetForm({ values: form })
|
||||
const errData = error.value.data
|
||||
let message
|
||||
|
||||
if (errData.path) {
|
||||
setFieldError(errData.path, errData.error)
|
||||
message = t('user_saving_fail')
|
||||
} else {
|
||||
feedback.value = {
|
||||
variant: 'error',
|
||||
icon: 'mdi:alert',
|
||||
message: errData.error || errData,
|
||||
}
|
||||
message = errData.error || errData
|
||||
}
|
||||
feedback.value = {
|
||||
variant: 'error',
|
||||
icon: 'mdi:alert',
|
||||
message,
|
||||
}
|
||||
} else if (data.value) {
|
||||
// redirect on password change
|
||||
|
@ -145,6 +149,7 @@ const onSubmit = handleSubmit(async (form) => {
|
|||
type="email"
|
||||
:label="$t('mail_addresses')"
|
||||
:input-label="$t('mail_address')"
|
||||
:button-label="$t('add_mail')"
|
||||
:placeholder="$t('new_mail')"
|
||||
class="mb-10"
|
||||
/>
|
||||
|
@ -154,6 +159,7 @@ const onSubmit = handleSubmit(async (form) => {
|
|||
type="email"
|
||||
:label="$t('mail_forwards')"
|
||||
:input-label="$t('mail_forward')"
|
||||
:button-label="$t('add_forward')"
|
||||
:placeholder="$t('new_forward')"
|
||||
/>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue