diff --git a/src/components/license/AAttributionEditor.vue b/src/components/license/AAttributionEditor.vue index edcd89a7f82b2530fa07a5e3b48bb9723f31ebb2..75198e3890bb6bb39b0362b7a061d1df87d4c582 100644 --- a/src/components/license/AAttributionEditor.vue +++ b/src/components/license/AAttributionEditor.vue @@ -1,5 +1,9 @@ <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"> <option v-for="license in licenseStore.items" :key="license.id" :value="license.id"> {{ license.name }} @@ -12,7 +16,11 @@ </ADescription> </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 v-model="credits" class="form-control" @@ -23,7 +31,10 @@ <FormGroup v-slot="controlAttributes" - :errors="[isUseExplicitlyGrantedByAuthorError]" + :errors="[ + ...errors.forField('isUseExplicitlyGrantedByAuthor'), + isUseExplicitlyGrantedByAuthorError, + ]" custom-control > <label class="tw-flex tw-gap-2 tw-items-center tw-mb-0"> @@ -47,8 +58,18 @@ import { Licensing } from '@/types' import { computed } from 'vue' import { useCopy } from '@/form' import { useI18n } from '@/i18n' +import { MappedErrorDetail, ErrorDetailArray } from '@rokoli/bnb/drf' const _attribution = defineModel<Licensing | null>({ required: true }) +withDefaults( + defineProps<{ + errors?: ErrorDetailArray<MappedErrorDetail> + }>(), + { + errors: () => new ErrorDetailArray<MappedErrorDetail>(), + }, +) + const defaultAttribution: Licensing = { licenseId: null, credits: '',