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
+7 -6
View File
@@ -6,6 +6,7 @@ import { apiFetch, API_BASE } from "@/lib/api";
import { ColorPickerField } from "@/components/admin/ColorPickerField";
import { BrandingPreviewPanel } from "@/components/admin/BrandingPreviewPanel";
import { extractDominantColors } from "@/lib/extractColors";
import { errorMessage } from "@/lib/utils";
type Step = 1 | 2 | 3 | 4 | 5 | 6;
@@ -144,8 +145,8 @@ export default function SetupPage() {
});
setSetupToken(res.token);
next();
} catch (e: any) {
setError(e?.message || "Failed to create admin account. Please try again.");
} catch (e) {
setError(errorMessage(e) || "Failed to create admin account. Please try again.");
} finally {
setLoading(false);
}
@@ -173,8 +174,8 @@ export default function SetupPage() {
},
});
setSmtpTestResult({ ok: true, message: res.message || "Connection successful." });
} catch (e: any) {
setSmtpTestResult({ ok: false, message: e?.message || "Connection failed." });
} catch (e) {
setSmtpTestResult({ ok: false, message: errorMessage(e) || "Connection failed." });
} finally {
setSmtpTesting(false);
}
@@ -260,8 +261,8 @@ export default function SetupPage() {
});
next(); // → step 6 (done)
} catch (e: any) {
setError(e?.message || "Setup failed. Please try again.");
} catch (e) {
setError(errorMessage(e) || "Setup failed. Please try again.");
} finally {
setLoading(false);
}