Type caught errors as unknown in the frontend

Replace `catch (e: any)` with `catch (e)` and read the message through a
new errorMessage() helper. ApiError.data gets a real type, and
useDismissingState's setter keeps one identity across renders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-21 11:10:00 +02:00
co-authored by Claude Opus 5.5
parent 9e8244bb71
commit 5024ab7241
55 changed files with 400 additions and 332 deletions
@@ -4,6 +4,7 @@ import React, { useState } from "react";
import { ArrowRightLeft } from "lucide-react";
import { apiFetch } from "@/lib/api";
import { isMinorOn } from "@/components/shared/AttendeeNamesEditor";
import { errorMessage } from "@/lib/utils";
/** Whether to offer "Transfer" on a ticket (the server checks the rules again). */
export function canOfferTransfer(ticket: any, event: any, isSupervisor = false): boolean {
@@ -42,8 +43,8 @@ export function TransferTicketModal({ ticket, event, token, onClose, onDone }: {
if (youth) Object.assign(body, { dateOfBirth: f.dateOfBirth, parentName: f.parentName, parentEmail: f.parentEmail, parentPhone: f.parentPhone });
const res = await apiFetch<{ message: string }>(`/api/tickets/${ticket.id}/transfer`, { method: "POST", authToken: token, body });
onDone(res.message);
} catch (err: any) {
setError(err?.message || "Couldn't transfer the ticket");
} catch (err) {
setError(errorMessage(err) || "Couldn't transfer the ticket");
} finally {
setBusy(false);
}