Archived
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:
@@ -6,6 +6,7 @@ import { apiFetch } from "@/lib/api";
|
||||
import { TwoFactorChallenge, isTwoFactorChallenge } from "@/lib/auth";
|
||||
import { CouponCodeField, AppliedCoupon } from "@/components/shared/CouponCodeField";
|
||||
import { AttendeeNamesEditor, AttendeeEntries, TicketDelivery, attendeesPayload, consentDetailsMissing } from "@/components/shared/AttendeeNamesEditor";
|
||||
import { errorMessage } from "@/lib/utils";
|
||||
|
||||
// ─── Types ────────────────────────────────────────────────────────────────────
|
||||
type EarlyBirdTier = { deadline: string; price: number; order?: number; variantId?: string | null };
|
||||
@@ -318,8 +319,8 @@ export default function SelfServicePage() {
|
||||
setSetupCode("");
|
||||
setSupervisorToken(data.token);
|
||||
await loadEvents(data.token);
|
||||
} catch (err: any) {
|
||||
setSetupError(err?.message || "Login failed. Please check your credentials.");
|
||||
} catch (err) {
|
||||
setSetupError(errorMessage(err) || "Login failed. Please check your credentials.");
|
||||
} finally {
|
||||
setSetupLoading(false);
|
||||
}
|
||||
@@ -361,8 +362,8 @@ export default function SelfServicePage() {
|
||||
setScreen("setup");
|
||||
setSelectedEventId("");
|
||||
resetForm();
|
||||
} catch (err: any) {
|
||||
setChangeError(err?.message || "Incorrect password.");
|
||||
} catch (err) {
|
||||
setChangeError(errorMessage(err) || "Incorrect password.");
|
||||
} finally {
|
||||
setChangeLoading(false);
|
||||
}
|
||||
@@ -455,8 +456,8 @@ export default function SelfServicePage() {
|
||||
setScreen("confirmation");
|
||||
startCountdown();
|
||||
}
|
||||
} catch (err: any) {
|
||||
setFormError(err?.message || "Registration failed. Please try again.");
|
||||
} catch (err) {
|
||||
setFormError(errorMessage(err) || "Registration failed. Please try again.");
|
||||
} finally {
|
||||
setFormLoading(false);
|
||||
}
|
||||
@@ -503,8 +504,8 @@ export default function SelfServicePage() {
|
||||
|
||||
setScreen("confirmation");
|
||||
startCountdown();
|
||||
} catch (err: any) {
|
||||
setFormSubmitError(err?.message || "Form submission failed. Please try again.");
|
||||
} catch (err) {
|
||||
setFormSubmitError(errorMessage(err) || "Form submission failed. Please try again.");
|
||||
} finally {
|
||||
setFormSubmitLoading(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user