fix: eliminate all TypeScript any usage across Vue components
Replace 24 `err: any` error handler types with proper `AxiosError<ApiErrorResponse>` typing. Fix additional `as any` casts and `Record<string, any>` patterns in registration field components, event settings, and portal layout. Create shared `ApiErrorResponse` type for portal app. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,8 +2,11 @@
|
||||
import { VForm } from 'vuetify/components/VForm'
|
||||
import { usePersonTagCategories } from '@/composables/api/usePersonTags'
|
||||
import { requiredValidator } from '@core/utils/validators'
|
||||
import type { RegistrationFormField } from '@/types/registration-form-field'
|
||||
import type { RegistrationFormField, RegistrationFormFieldCreateDTO } from '@/types/registration-form-field'
|
||||
import type { RegistrationFieldType } from '@/types/registration-field-template'
|
||||
import { FIELD_TYPE_LABELS, FIELD_TYPES_WITH_OPTIONS } from '@/types/registration-field-template'
|
||||
import type { AxiosError } from 'axios'
|
||||
import type { ApiErrorResponse } from '@/types/auth'
|
||||
|
||||
const props = defineProps<{
|
||||
orgId: string
|
||||
@@ -12,7 +15,7 @@ const props = defineProps<{
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
save: [payload: Record<string, any>]
|
||||
save: [payload: Partial<RegistrationFormFieldCreateDTO>]
|
||||
'update:modelValue': [value: boolean]
|
||||
}>()
|
||||
|
||||
@@ -46,7 +49,7 @@ const dialogTitle = computed(() =>
|
||||
)
|
||||
|
||||
const showOptions = computed(() =>
|
||||
FIELD_TYPES_WITH_OPTIONS.includes(form.value.field_type as any),
|
||||
(FIELD_TYPES_WITH_OPTIONS as readonly string[]).includes(form.value.field_type),
|
||||
)
|
||||
|
||||
const showTagCategory = computed(() => form.value.field_type === 'tag_picker')
|
||||
@@ -87,7 +90,7 @@ function onSubmit() {
|
||||
if (!valid) return
|
||||
|
||||
errors.value = {}
|
||||
const payload: Record<string, any> = {
|
||||
const payload: Partial<RegistrationFormFieldCreateDTO> = {
|
||||
label: form.value.label,
|
||||
is_required: form.value.is_required,
|
||||
is_filterable: form.value.is_filterable,
|
||||
@@ -98,7 +101,7 @@ function onSubmit() {
|
||||
}
|
||||
|
||||
if (!props.field) {
|
||||
payload.field_type = form.value.field_type
|
||||
payload.field_type = form.value.field_type as RegistrationFieldType
|
||||
}
|
||||
|
||||
if (showOptions.value) {
|
||||
@@ -119,8 +122,8 @@ function onSubmit() {
|
||||
})
|
||||
}
|
||||
|
||||
function setErrors(err: any) {
|
||||
const data = err.response?.data
|
||||
function setErrors(err: Error) {
|
||||
const data = (err as AxiosError<ApiErrorResponse>).response?.data
|
||||
if (data?.errors) {
|
||||
errors.value = Object.fromEntries(
|
||||
Object.entries(data.errors).map(([k, v]) => [k, (v as string[])[0]]),
|
||||
|
||||
@@ -3,6 +3,8 @@ import { VForm } from 'vuetify/components/VForm'
|
||||
import { useCreateEvent } from '@/composables/api/useEvents'
|
||||
import { requiredValidator } from '@core/utils/validators'
|
||||
import type { EventTypeEnum } from '@/types/event'
|
||||
import type { AxiosError } from 'axios'
|
||||
import type { ApiErrorResponse } from '@/types/auth'
|
||||
|
||||
const props = defineProps<{
|
||||
orgId: string
|
||||
@@ -111,8 +113,8 @@ function onSubmit() {
|
||||
modelValue.value = false
|
||||
showSuccess.value = true
|
||||
},
|
||||
onError: (err: any) => {
|
||||
const data = err.response?.data
|
||||
onError: (err: Error) => {
|
||||
const data = (err as AxiosError<ApiErrorResponse>).response?.data
|
||||
if (data?.errors) {
|
||||
errors.value = Object.fromEntries(
|
||||
Object.entries(data.errors).map(([k, v]) => [k, (v as string[])[0]]),
|
||||
|
||||
@@ -3,6 +3,8 @@ import { VForm } from 'vuetify/components/VForm'
|
||||
import { useCreateSubEvent } from '@/composables/api/useEvents'
|
||||
import { requiredValidator } from '@core/utils/validators'
|
||||
import type { EventItem, EventStatus } from '@/types/event'
|
||||
import type { AxiosError } from 'axios'
|
||||
import type { ApiErrorResponse } from '@/types/auth'
|
||||
|
||||
const props = defineProps<{
|
||||
parentEvent: EventItem
|
||||
@@ -74,8 +76,8 @@ function onSubmit() {
|
||||
modelValue.value = false
|
||||
showSuccess.value = true
|
||||
},
|
||||
onError: (err: any) => {
|
||||
const data = err.response?.data
|
||||
onError: (err: Error) => {
|
||||
const data = (err as AxiosError<ApiErrorResponse>).response?.data
|
||||
if (data?.errors) {
|
||||
errors.value = Object.fromEntries(
|
||||
Object.entries(data.errors).map(([k, v]) => [k, (v as string[])[0]]),
|
||||
|
||||
@@ -3,6 +3,8 @@ import { VForm } from 'vuetify/components/VForm'
|
||||
import { useUpdateEvent } from '@/composables/api/useEvents'
|
||||
import { requiredValidator } from '@core/utils/validators'
|
||||
import type { EventItem } from '@/types/event'
|
||||
import type { AxiosError } from 'axios'
|
||||
import type { ApiErrorResponse } from '@/types/auth'
|
||||
|
||||
const props = defineProps<{
|
||||
event: EventItem
|
||||
@@ -97,8 +99,8 @@ function onSubmit() {
|
||||
modelValue.value = false
|
||||
showSuccess.value = true
|
||||
},
|
||||
onError: (err: any) => {
|
||||
const data = err.response?.data
|
||||
onError: (err: Error) => {
|
||||
const data = (err as AxiosError<ApiErrorResponse>).response?.data
|
||||
if (data?.errors) {
|
||||
errors.value = Object.fromEntries(
|
||||
Object.entries(data.errors).map(([k, v]) => [k, (v as string[])[0]]),
|
||||
|
||||
@@ -4,6 +4,8 @@ import { useUpdateMemberRole } from '@/composables/api/useMembers'
|
||||
import { useAuthStore } from '@/stores/useAuthStore'
|
||||
import { requiredValidator } from '@core/utils/validators'
|
||||
import type { Member, OrganisationRole } from '@/types/member'
|
||||
import type { AxiosError } from 'axios'
|
||||
import type { ApiErrorResponse } from '@/types/auth'
|
||||
|
||||
const props = defineProps<{
|
||||
orgId: string
|
||||
@@ -51,8 +53,8 @@ function onSubmit() {
|
||||
modelValue.value = false
|
||||
showSuccess.value = true
|
||||
},
|
||||
onError: (err: any) => {
|
||||
const data = err.response?.data
|
||||
onError: (err: Error) => {
|
||||
const data = (err as AxiosError<ApiErrorResponse>).response?.data
|
||||
if (data?.errors) {
|
||||
errors.value = { role: data.errors.role?.[0] ?? '' }
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ import { VForm } from 'vuetify/components/VForm'
|
||||
import { useInviteMember } from '@/composables/api/useMembers'
|
||||
import { emailValidator, requiredValidator } from '@core/utils/validators'
|
||||
import type { OrganisationRole } from '@/types/member'
|
||||
import type { AxiosError } from 'axios'
|
||||
import type { ApiErrorResponse } from '@/types/auth'
|
||||
|
||||
const props = defineProps<{
|
||||
orgId: string
|
||||
@@ -50,8 +52,8 @@ function onSubmit() {
|
||||
modelValue.value = false
|
||||
showSuccess.value = true
|
||||
},
|
||||
onError: (err: any) => {
|
||||
const data = err.response?.data
|
||||
onError: (err: Error) => {
|
||||
const data = (err as AxiosError<ApiErrorResponse>).response?.data
|
||||
if (data?.errors) {
|
||||
errors.value = {
|
||||
email: data.errors.email?.[0] ?? '',
|
||||
|
||||
@@ -3,6 +3,8 @@ import { VForm } from 'vuetify/components/VForm'
|
||||
import { useCreateCompany, useUpdateCompany } from '@/composables/api/useCompanies'
|
||||
import { requiredValidator, emailValidator } from '@core/utils/validators'
|
||||
import type { Company } from '@/types/organisation'
|
||||
import type { AxiosError } from 'axios'
|
||||
import type { ApiErrorResponse } from '@/types/auth'
|
||||
|
||||
const props = defineProps<{
|
||||
orgId: string
|
||||
@@ -90,8 +92,8 @@ function onSubmit() {
|
||||
emit('saved')
|
||||
}
|
||||
|
||||
const onError = (err: any) => {
|
||||
const data = err.response?.data
|
||||
const onError = (err: Error) => {
|
||||
const data = (err as AxiosError<ApiErrorResponse>).response?.data
|
||||
if (data?.errors) {
|
||||
errors.value = Object.fromEntries(
|
||||
Object.entries(data.errors).map(([k, v]) => [k, (v as string[])[0]]),
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
import { VForm } from 'vuetify/components/VForm'
|
||||
import { useEmailSettings, useUpdateEmailSettings } from '@/composables/api/useEmail'
|
||||
import { emailValidator } from '@core/utils/validators'
|
||||
import type { AxiosError } from 'axios'
|
||||
import type { ApiErrorResponse } from '@/types/auth'
|
||||
|
||||
const props = defineProps<{
|
||||
orgId: string
|
||||
@@ -68,9 +70,10 @@ async function onSubmit() {
|
||||
onSuccess: () => {
|
||||
snackbar.value = true
|
||||
},
|
||||
onError: (error: any) => {
|
||||
if (error.response?.status === 422 && error.response?.data?.errors) {
|
||||
serverErrors.value = error.response.data.errors
|
||||
onError: (error: Error) => {
|
||||
const axiosError = error as AxiosError<ApiErrorResponse>
|
||||
if (axiosError.response?.status === 422 && axiosError.response?.data?.errors) {
|
||||
serverErrors.value = axiosError.response.data.errors
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
@@ -11,6 +11,8 @@ import { useAuthStore } from '@/stores/useAuthStore'
|
||||
import { TEMPLATE_VARIABLES } from '@/types/email'
|
||||
import type { EmailTemplate, UpdateEmailTemplatePayload } from '@/types/email'
|
||||
import { emailValidator, requiredValidator } from '@core/utils/validators'
|
||||
import type { AxiosError } from 'axios'
|
||||
import type { ApiErrorResponse } from '@/types/auth'
|
||||
|
||||
const props = defineProps<{
|
||||
orgId: string
|
||||
@@ -89,9 +91,10 @@ function onEditSubmit() {
|
||||
snackbarMessage.value = 'Template opgeslagen'
|
||||
snackbar.value = true
|
||||
},
|
||||
onError: (error: any) => {
|
||||
if (error.response?.status === 422 && error.response?.data?.errors) {
|
||||
editErrors.value = error.response.data.errors
|
||||
onError: (error: Error) => {
|
||||
const axiosError = error as AxiosError<ApiErrorResponse>
|
||||
if (axiosError.response?.status === 422 && axiosError.response?.data?.errors) {
|
||||
editErrors.value = axiosError.response.data.errors
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
@@ -9,6 +9,8 @@ import {
|
||||
} from '@/composables/api/usePersonTags'
|
||||
import { requiredValidator } from '@core/utils/validators'
|
||||
import type { PersonTag } from '@/types/person-tag'
|
||||
import type { AxiosError } from 'axios'
|
||||
import type { ApiErrorResponse } from '@/types/auth'
|
||||
|
||||
const props = defineProps<{
|
||||
orgId: string
|
||||
@@ -139,8 +141,8 @@ function onSubmit() {
|
||||
})
|
||||
}
|
||||
|
||||
function handleError(err: any) {
|
||||
const data = err.response?.data
|
||||
function handleError(err: Error) {
|
||||
const data = (err as AxiosError<ApiErrorResponse>).response?.data
|
||||
if (data?.errors) {
|
||||
errors.value = Object.fromEntries(
|
||||
Object.entries(data.errors).map(([k, v]) => [k, (v as string[])[0]]),
|
||||
|
||||
@@ -8,8 +8,10 @@ import {
|
||||
} from '@/composables/api/useRegistrationFieldTemplates'
|
||||
import { usePersonTagCategories } from '@/composables/api/usePersonTags'
|
||||
import { requiredValidator } from '@core/utils/validators'
|
||||
import type { RegistrationFieldTemplate } from '@/types/registration-field-template'
|
||||
import type { RegistrationFieldTemplate, RegistrationFieldTemplateCreateDTO, RegistrationFieldType } from '@/types/registration-field-template'
|
||||
import { FIELD_TYPE_LABELS, FIELD_TYPES_WITH_OPTIONS } from '@/types/registration-field-template'
|
||||
import type { AxiosError } from 'axios'
|
||||
import type { ApiErrorResponse } from '@/types/auth'
|
||||
|
||||
const props = defineProps<{
|
||||
orgId: string
|
||||
@@ -67,7 +69,7 @@ const dialogTitle = computed(() =>
|
||||
const isSaving = computed(() => isCreating.value || isUpdating.value)
|
||||
|
||||
const showOptions = computed(() =>
|
||||
FIELD_TYPES_WITH_OPTIONS.includes(form.value.field_type as any),
|
||||
(FIELD_TYPES_WITH_OPTIONS as readonly string[]).includes(form.value.field_type),
|
||||
)
|
||||
|
||||
const showTagCategory = computed(() => form.value.field_type === 'tag_picker')
|
||||
@@ -115,7 +117,7 @@ function onSubmit() {
|
||||
if (!valid) return
|
||||
|
||||
errors.value = {}
|
||||
const payload: Record<string, any> = {
|
||||
const payload: Partial<RegistrationFieldTemplateCreateDTO> = {
|
||||
label: form.value.label,
|
||||
is_required: form.value.is_required,
|
||||
is_filterable: form.value.is_filterable,
|
||||
@@ -127,7 +129,7 @@ function onSubmit() {
|
||||
}
|
||||
|
||||
if (!editingTemplate.value) {
|
||||
payload.field_type = form.value.field_type
|
||||
payload.field_type = form.value.field_type as RegistrationFieldType
|
||||
}
|
||||
|
||||
if (showOptions.value) {
|
||||
@@ -155,7 +157,7 @@ function onSubmit() {
|
||||
)
|
||||
}
|
||||
else {
|
||||
createTemplate(payload as any, {
|
||||
createTemplate(payload as RegistrationFieldTemplateCreateDTO, {
|
||||
onSuccess: () => {
|
||||
isDialogOpen.value = false
|
||||
successMessage.value = `${form.value.label} aangemaakt`
|
||||
@@ -167,8 +169,8 @@ function onSubmit() {
|
||||
})
|
||||
}
|
||||
|
||||
function handleError(err: any) {
|
||||
const data = err.response?.data
|
||||
function handleError(err: Error) {
|
||||
const data = (err as AxiosError<ApiErrorResponse>).response?.data
|
||||
if (data?.errors) {
|
||||
errors.value = Object.fromEntries(
|
||||
Object.entries(data.errors).map(([k, v]) => [k, (v as string[])[0]]),
|
||||
|
||||
@@ -3,6 +3,8 @@ import { VForm } from 'vuetify/components/VForm'
|
||||
import { useCrowdTypeList, useCreateCrowdType, useUpdateCrowdType, useDeleteCrowdType } from '@/composables/api/useCrowdTypes'
|
||||
import { requiredValidator } from '@core/utils/validators'
|
||||
import type { CrowdType } from '@/types/organisation'
|
||||
import type { AxiosError } from 'axios'
|
||||
import type { ApiErrorResponse } from '@/types/auth'
|
||||
|
||||
const props = defineProps<{
|
||||
orgId: string
|
||||
@@ -128,8 +130,8 @@ function onSubmit() {
|
||||
})
|
||||
}
|
||||
|
||||
function handleError(err: any) {
|
||||
const data = err.response?.data
|
||||
function handleError(err: Error) {
|
||||
const data = (err as AxiosError<ApiErrorResponse>).response?.data
|
||||
if (data?.errors) {
|
||||
errors.value = Object.fromEntries(
|
||||
Object.entries(data.errors).map(([k, v]) => [k, (v as string[])[0]]),
|
||||
|
||||
@@ -3,6 +3,8 @@ import { VForm } from 'vuetify/components/VForm'
|
||||
import { useUpdateOrganisation } from '@/composables/api/useOrganisations'
|
||||
import { requiredValidator } from '@core/utils/validators'
|
||||
import type { Organisation } from '@/types/organisation'
|
||||
import type { AxiosError } from 'axios'
|
||||
import type { ApiErrorResponse } from '@/types/auth'
|
||||
|
||||
const props = defineProps<{
|
||||
organisation: Organisation
|
||||
@@ -34,8 +36,8 @@ function onSubmit() {
|
||||
modelValue.value = false
|
||||
showSuccess.value = true
|
||||
},
|
||||
onError: (err: any) => {
|
||||
const data = err.response?.data
|
||||
onError: (err: Error) => {
|
||||
const data = (err as AxiosError<ApiErrorResponse>).response?.data
|
||||
if (data?.errors) {
|
||||
errors.value = { name: data.errors.name?.[0] ?? '' }
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import { useCrowdTypeList } from '@/composables/api/useCrowdTypes'
|
||||
import { useCompanies } from '@/composables/api/useCompanies'
|
||||
import { requiredValidator, emailValidator } from '@core/utils/validators'
|
||||
import type { PersonStatus } from '@/types/person'
|
||||
import type { AxiosError } from 'axios'
|
||||
import type { ApiErrorResponse } from '@/types/auth'
|
||||
|
||||
const props = defineProps<{
|
||||
eventId: string
|
||||
@@ -106,11 +108,11 @@ function onSubmit() {
|
||||
modelValue.value = false
|
||||
showSuccess.value = true
|
||||
},
|
||||
onError: (err: any) => {
|
||||
const data = err.response?.data
|
||||
onError: (err: Error) => {
|
||||
const data = (err as AxiosError<ApiErrorResponse>).response?.data
|
||||
if (data?.errors) {
|
||||
errors.value = Object.fromEntries(
|
||||
Object.entries(data.errors).map(([k, v]) => [k, (v as string[])[0]]),
|
||||
Object.entries(data.errors).map(([k, v]) => [k, v[0]]),
|
||||
)
|
||||
}
|
||||
else if (data?.message) {
|
||||
|
||||
@@ -5,6 +5,8 @@ import { useCrowdTypeList } from '@/composables/api/useCrowdTypes'
|
||||
import { useCompanies } from '@/composables/api/useCompanies'
|
||||
import { requiredValidator, emailValidator } from '@core/utils/validators'
|
||||
import type { Person, PersonStatus } from '@/types/person'
|
||||
import type { AxiosError } from 'axios'
|
||||
import type { ApiErrorResponse } from '@/types/auth'
|
||||
|
||||
const props = defineProps<{
|
||||
person: Person
|
||||
@@ -110,11 +112,11 @@ function onSubmit() {
|
||||
modelValue.value = false
|
||||
showSuccess.value = true
|
||||
},
|
||||
onError: (err: any) => {
|
||||
const data = err.response?.data
|
||||
onError: (err: Error) => {
|
||||
const data = (err as AxiosError<ApiErrorResponse>).response?.data
|
||||
if (data?.errors) {
|
||||
errors.value = Object.fromEntries(
|
||||
Object.entries(data.errors).map(([k, v]) => [k, (v as string[])[0]]),
|
||||
Object.entries(data.errors).map(([k, v]) => [k, v[0]]),
|
||||
)
|
||||
}
|
||||
else if (data?.message) {
|
||||
|
||||
@@ -4,6 +4,8 @@ import { usePersonList } from '@/composables/api/usePersons'
|
||||
import { useAuthStore } from '@/stores/useAuthStore'
|
||||
import type { Shift } from '@/types/section'
|
||||
import type { Person } from '@/types/person'
|
||||
import type { AxiosError } from 'axios'
|
||||
import type { ApiErrorResponse } from '@/types/auth'
|
||||
|
||||
const props = defineProps<{
|
||||
eventId: string
|
||||
@@ -66,8 +68,8 @@ function onSubmit() {
|
||||
modelValue.value = false
|
||||
selectedPersonId.value = ''
|
||||
},
|
||||
onError: (err: any) => {
|
||||
const data = err.response?.data
|
||||
onError: (err: Error) => {
|
||||
const data = (err as AxiosError<ApiErrorResponse>).response?.data
|
||||
if (data?.errors) {
|
||||
errors.value = Object.fromEntries(
|
||||
Object.entries(data.errors).map(([k, v]) => [k, (v as string[])[0]]),
|
||||
|
||||
@@ -4,6 +4,8 @@ import { useCreateSection, useSectionCategories } from '@/composables/api/useSec
|
||||
import { useAuthStore } from '@/stores/useAuthStore'
|
||||
import { requiredValidator } from '@core/utils/validators'
|
||||
import type { SectionType } from '@/types/section'
|
||||
import type { AxiosError } from 'axios'
|
||||
import type { ApiErrorResponse } from '@/types/auth'
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
eventId: string
|
||||
@@ -92,8 +94,8 @@ function onSubmit() {
|
||||
parentEventName: result.parentEventName,
|
||||
})
|
||||
},
|
||||
onError: (err: any) => {
|
||||
const data = err.response?.data
|
||||
onError: (err: Error) => {
|
||||
const data = (err as AxiosError<ApiErrorResponse>).response?.data
|
||||
if (data?.errors) {
|
||||
errors.value = Object.fromEntries(
|
||||
Object.entries(data.errors).map(([k, v]) => [k, (v as string[])[0]]),
|
||||
|
||||
@@ -7,6 +7,8 @@ import { useAuthStore } from '@/stores/useAuthStore'
|
||||
import { useTimeSlotDropdown } from '@/composables/useTimeSlotDropdown'
|
||||
import { requiredValidator } from '@core/utils/validators'
|
||||
import type { FestivalSection, Shift, ShiftStatus } from '@/types/section'
|
||||
import type { AxiosError } from 'axios'
|
||||
import type { ApiErrorResponse } from '@/types/auth'
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
eventId: string
|
||||
@@ -184,8 +186,8 @@ function onSubmit() {
|
||||
onSuccess: () => {
|
||||
modelValue.value = false
|
||||
},
|
||||
onError: (err: any) => {
|
||||
const data = err.response?.data
|
||||
onError: (err: Error) => {
|
||||
const data = (err as AxiosError<ApiErrorResponse>).response?.data
|
||||
if (data?.errors) {
|
||||
errors.value = Object.fromEntries(
|
||||
Object.entries(data.errors).map(([k, v]) => [k, (v as string[])[0]]),
|
||||
|
||||
@@ -4,6 +4,8 @@ import { useCreateTimeSlot, useUpdateTimeSlot } from '@/composables/api/useTimeS
|
||||
import { useAuthStore } from '@/stores/useAuthStore'
|
||||
import { requiredValidator } from '@core/utils/validators'
|
||||
import type { TimeSlot } from '@/types/section'
|
||||
import type { AxiosError } from 'axios'
|
||||
import type { ApiErrorResponse } from '@/types/auth'
|
||||
|
||||
const props = defineProps<{
|
||||
eventId: string
|
||||
@@ -127,8 +129,8 @@ function onSubmit() {
|
||||
onSuccess: () => {
|
||||
modelValue.value = false
|
||||
},
|
||||
onError: (err: any) => {
|
||||
const data = err.response?.data
|
||||
onError: (err: Error) => {
|
||||
const data = (err as AxiosError<ApiErrorResponse>).response?.data
|
||||
if (data?.errors) {
|
||||
errors.value = Object.fromEntries(
|
||||
Object.entries(data.errors).map(([k, v]) => [k, (v as string[])[0]]),
|
||||
|
||||
@@ -4,6 +4,8 @@ import { useUpdateSection, useSectionCategories } from '@/composables/api/useSec
|
||||
import { useAuthStore } from '@/stores/useAuthStore'
|
||||
import { requiredValidator } from '@core/utils/validators'
|
||||
import type { FestivalSection, SectionType } from '@/types/section'
|
||||
import type { AxiosError } from 'axios'
|
||||
import type { ApiErrorResponse } from '@/types/auth'
|
||||
|
||||
const props = defineProps<{
|
||||
eventId: string
|
||||
@@ -91,8 +93,8 @@ function onSubmit() {
|
||||
modelValue.value = false
|
||||
emit('updated')
|
||||
},
|
||||
onError: (err: any) => {
|
||||
const data = err.response?.data
|
||||
onError: (err: Error) => {
|
||||
const data = (err as AxiosError<ApiErrorResponse>).response?.data
|
||||
if (data?.errors) {
|
||||
errors.value = Object.fromEntries(
|
||||
Object.entries(data.errors).map(([k, v]) => [k, (v as string[])[0]]),
|
||||
|
||||
@@ -3,7 +3,7 @@ import { VForm } from 'vuetify/components/VForm'
|
||||
import EventTabsNav from '@/components/events/EventTabsNav.vue'
|
||||
import { useUpdateEvent, useUploadEventImage } from '@/composables/api/useEvents'
|
||||
import { useAuthStore } from '@/stores/useAuthStore'
|
||||
import type { EventItem } from '@/types/event'
|
||||
import type { EventItem, UpdateEventPayload } from '@/types/event'
|
||||
|
||||
definePage({
|
||||
meta: {
|
||||
@@ -55,7 +55,7 @@ function onFileSelected(files: File[], type: 'banner' | 'logo') {
|
||||
function onClearImage(event: EventItem, type: 'banner' | 'logo') {
|
||||
const field = type === 'banner' ? 'registration_banner_url' : 'registration_logo_url'
|
||||
|
||||
updateEvent({ [field]: null } as any)
|
||||
updateEvent({ [field]: null } as UpdateEventPayload)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
} from '@/composables/api/useRegistrationFormFields'
|
||||
import { useAuthStore } from '@/stores/useAuthStore'
|
||||
import { useNotificationStore } from '@/stores/useNotificationStore'
|
||||
import type { RegistrationFormField } from '@/types/registration-form-field'
|
||||
import type { RegistrationFormField, RegistrationFormFieldCreateDTO } from '@/types/registration-form-field'
|
||||
import type { EventItem } from '@/types/event'
|
||||
|
||||
definePage({
|
||||
@@ -97,7 +97,7 @@ function openEditDialog(field: RegistrationFormField) {
|
||||
isFieldDialogOpen.value = true
|
||||
}
|
||||
|
||||
function onSaveField(payload: Record<string, any>) {
|
||||
function onSaveField(payload: Partial<RegistrationFormFieldCreateDTO>) {
|
||||
if (editingField.value) {
|
||||
updateField(
|
||||
{ id: editingField.value.id, ...payload },
|
||||
@@ -111,7 +111,7 @@ function onSaveField(payload: Record<string, any>) {
|
||||
)
|
||||
}
|
||||
else {
|
||||
createField(payload as any, {
|
||||
createField(payload as RegistrationFormFieldCreateDTO, {
|
||||
onSuccess: () => {
|
||||
isFieldDialogOpen.value = false
|
||||
notificationStore.show(`${payload.label} aangemaakt`, 'success')
|
||||
|
||||
@@ -6,6 +6,8 @@ import { requiredValidator } from '@core/utils/validators'
|
||||
import { VNodeRenderer } from '@layouts/components/VNodeRenderer'
|
||||
import { themeConfig } from '@themeConfig'
|
||||
import type { OrganisationRole } from '@/types/member'
|
||||
import type { AxiosError } from 'axios'
|
||||
import type { ApiErrorResponse } from '@/types/auth'
|
||||
|
||||
definePage({
|
||||
meta: {
|
||||
@@ -68,8 +70,8 @@ function onSubmit() {
|
||||
authStore.setUser(response.data.user)
|
||||
router.replace('/dashboard')
|
||||
},
|
||||
onError: (err: any) => {
|
||||
const data = err.response?.data
|
||||
onError: (err: Error) => {
|
||||
const data = (err as AxiosError<ApiErrorResponse>).response?.data
|
||||
if (data?.errors) {
|
||||
errors.value = {
|
||||
name: data.errors.name?.[0] ?? '',
|
||||
|
||||
@@ -54,6 +54,8 @@ export interface CreateEventPayload {
|
||||
|
||||
export interface UpdateEventPayload extends Partial<CreateEventPayload> {
|
||||
status?: EventStatus
|
||||
registration_banner_url?: string | null
|
||||
registration_logo_url?: string | null
|
||||
registration_welcome_text?: string | null
|
||||
registration_show_section_preferences?: boolean
|
||||
registration_show_availability?: boolean
|
||||
|
||||
Reference in New Issue
Block a user