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
@@ -6,6 +6,7 @@ import { useRouter, useSearchParams } from "next/navigation";
import { apiFetch } from "@/lib/api";
import { useDismissingState } from "@/hooks/useDismissingState";
import { Ticket } from "lucide-react";
import { errorMessage } from "@/lib/utils";
// Format a Date (or date-like input) to the value expected by <input type="datetime-local">
// This returns local time (browser timezone) as YYYY-MM-DDTHH:mm
@@ -161,8 +162,8 @@ function EventOptionsContent() {
setNewOpt({ name: "", price: "", isMainTicket: false });
setInfo("Option created");
await loadEvents();
} catch (e: any) {
setError(e?.message || "Failed to create option");
} catch (e) {
setError(errorMessage(e) || "Failed to create option");
}
};
@@ -177,8 +178,8 @@ function EventOptionsContent() {
});
setInfo("Option updated");
await loadEvents();
} catch (e: any) {
setError(e?.message || "Failed to update option");
} catch (e) {
setError(errorMessage(e) || "Failed to update option");
}
};
@@ -192,8 +193,8 @@ function EventOptionsContent() {
});
setInfo("Option deleted");
await loadEvents();
} catch (e: any) {
setError(e?.message || "Failed to delete option");
} catch (e) {
setError(errorMessage(e) || "Failed to delete option");
}
};