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 958a5a5950
commit 619b5b9a93
55 changed files with 400 additions and 332 deletions
@@ -5,6 +5,7 @@ import { Footer } from "@/components/layout/Footer";
import { useSearchParams, useRouter } from "next/navigation";
import { useAuth } from "@/hooks/useAuth";
import { CheckCircle2 } from "lucide-react";
import { errorMessage } from "@/lib/utils";
type FormField = { id: string; type: 'yes_no'|'text'|'date'|'numeric'|'statement'|'paragraph'|'rating'|'multiple_choice'; label: string; isRequired?: boolean; helpText?: string|null; options?: unknown };
@@ -36,8 +37,8 @@ function RegistrationSuccessContent() {
const ev = await (await import('@/lib/api')).apiFetch(`/api/events/${encodeURIComponent(r.eventId)}`);
if (ev?.form) setForm(ev.form);
}
} catch (e: any) {
setError(e?.message || 'Failed to load details');
} catch (e) {
setError(errorMessage(e) || 'Failed to load details');
}
})();
}, [registrationId, token]);
@@ -92,8 +93,8 @@ function RegistrationSuccessContent() {
}
if (!res.redirectUrl) { setError('Failed to create checkout'); return; }
window.location.href = res.redirectUrl;
} catch (e: any) {
setError(e?.message || 'Failed to create checkout');
} catch (e) {
setError(errorMessage(e) || 'Failed to create checkout');
} finally {
setPayLoading(false);
}