Skip to content
Snippets Groups Projects
Commit 904bb3d9 authored by Konrad Mohrfeldt's avatar Konrad Mohrfeldt :koala:
Browse files

feat: add error mapping support to attribution editor

parent fb73db99
No related branches found
No related tags found
No related merge requests found
<template> <template>
<FormGroup v-slot="controlAttributes" :label="t('image.license')"> <FormGroup
v-slot="controlAttributes"
:label="t('image.license')"
:errors="errors.forField('licenseId')"
>
<select v-model="licenseId" class="form-control" required v-bind="controlAttributes"> <select v-model="licenseId" class="form-control" required v-bind="controlAttributes">
<option v-for="license in licenseStore.items" :key="license.id" :value="license.id"> <option v-for="license in licenseStore.items" :key="license.id" :value="license.id">
{{ license.name }} {{ license.name }}
...@@ -12,7 +16,11 @@ ...@@ -12,7 +16,11 @@
</ADescription> </ADescription>
</FormGroup> </FormGroup>
<FormGroup v-slot="controlAttributes" :label="t('image.credits')" :errors="[needsAuthorError]"> <FormGroup
v-slot="controlAttributes"
:label="t('image.credits')"
:errors="[...errors.forField('credits'), needsAuthorError]"
>
<input <input
v-model="credits" v-model="credits"
class="form-control" class="form-control"
...@@ -23,7 +31,10 @@ ...@@ -23,7 +31,10 @@
<FormGroup <FormGroup
v-slot="controlAttributes" v-slot="controlAttributes"
:errors="[isUseExplicitlyGrantedByAuthorError]" :errors="[
...errors.forField('isUseExplicitlyGrantedByAuthor'),
isUseExplicitlyGrantedByAuthorError,
]"
custom-control custom-control
> >
<label class="tw-flex tw-gap-2 tw-items-center tw-mb-0"> <label class="tw-flex tw-gap-2 tw-items-center tw-mb-0">
...@@ -47,8 +58,18 @@ import { Licensing } from '@/types' ...@@ -47,8 +58,18 @@ import { Licensing } from '@/types'
import { computed } from 'vue' import { computed } from 'vue'
import { useCopy } from '@/form' import { useCopy } from '@/form'
import { useI18n } from '@/i18n' import { useI18n } from '@/i18n'
import { MappedErrorDetail, ErrorDetailArray } from '@rokoli/bnb/drf'
const _attribution = defineModel<Licensing | null>({ required: true }) const _attribution = defineModel<Licensing | null>({ required: true })
withDefaults(
defineProps<{
errors?: ErrorDetailArray<MappedErrorDetail>
}>(),
{
errors: () => new ErrorDetailArray<MappedErrorDetail>(),
},
)
const defaultAttribution: Licensing = { const defaultAttribution: Licensing = {
licenseId: null, licenseId: null,
credits: '', credits: '',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment