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:
@@ -7,6 +7,8 @@ import { apiClient } from '@/lib/axios'
|
||||
import MfaTotpSetupDialog from '@/components/settings/MfaTotpSetupDialog.vue'
|
||||
import MfaEmailSetupDialog from '@/components/settings/MfaEmailSetupDialog.vue'
|
||||
import MfaDisableDialog from '@/components/settings/MfaDisableDialog.vue'
|
||||
import axios from 'axios'
|
||||
import type { ApiErrorResponse } from '@/types/api'
|
||||
|
||||
definePage({
|
||||
name: 'portal-profiel',
|
||||
@@ -199,14 +201,19 @@ async function saveProfile() {
|
||||
snackbarColor.value = 'success'
|
||||
snackbar.value = true
|
||||
}
|
||||
catch (err: any) {
|
||||
const data = err?.response?.data
|
||||
if (data?.errors) {
|
||||
const firstError = Object.values(data.errors).flat()[0] as string
|
||||
profileError.value = firstError
|
||||
catch (err: unknown) {
|
||||
if (axios.isAxiosError<ApiErrorResponse>(err)) {
|
||||
const data = err.response?.data
|
||||
if (data?.errors) {
|
||||
const firstError = Object.values(data.errors).flat()[0]
|
||||
profileError.value = firstError ?? 'Er is een fout opgetreden.'
|
||||
}
|
||||
else {
|
||||
profileError.value = data?.message ?? 'Er is een fout opgetreden.'
|
||||
}
|
||||
}
|
||||
else {
|
||||
profileError.value = data?.message ?? 'Er is een fout opgetreden.'
|
||||
profileError.value = 'Er is een fout opgetreden.'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -228,16 +235,21 @@ async function savePassword() {
|
||||
snackbarColor.value = 'success'
|
||||
snackbar.value = true
|
||||
}
|
||||
catch (err: any) {
|
||||
const data = err?.response?.data
|
||||
if (data?.errors) {
|
||||
passwordFieldErrors.value = {}
|
||||
for (const [key, messages] of Object.entries(data.errors)) {
|
||||
passwordFieldErrors.value[key] = (messages as string[])[0]
|
||||
catch (err: unknown) {
|
||||
if (axios.isAxiosError<ApiErrorResponse>(err)) {
|
||||
const data = err.response?.data
|
||||
if (data?.errors) {
|
||||
passwordFieldErrors.value = {}
|
||||
for (const [key, messages] of Object.entries(data.errors)) {
|
||||
passwordFieldErrors.value[key] = messages[0]
|
||||
}
|
||||
}
|
||||
else {
|
||||
passwordError.value = data?.message ?? 'Er is een fout opgetreden.'
|
||||
}
|
||||
}
|
||||
else {
|
||||
passwordError.value = data?.message ?? 'Er is een fout opgetreden.'
|
||||
passwordError.value = 'Er is een fout opgetreden.'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user