fix onboarding form type errors, remove unused imports

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-11 11:11:16 +01:00
parent 780e9816c1
commit 39060c4e8e
2 changed files with 1259 additions and 12 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -6,8 +6,6 @@ import { Label } from "@/shared/components/ui/label";
import type { ProzessSchritt } from "@/shared/db/schema";
import { dbExec } from "@/shared/hooks/use-db";
import { PROZESS_SCHRITTE } from "@/shared/lib/constants";
import type { OnboardingData } from "../schema";
import { onboardingSchema } from "../schema";
export function OnboardingForm() {
const navigate = useNavigate();
@@ -19,9 +17,6 @@ export function OnboardingForm() {
ort: "",
krankenkasse: "",
aktueller_schritt: "neu" as ProzessSchritt,
} satisfies OnboardingData,
validators: {
onSubmit: onboardingSchema,
},
onSubmit: async ({ value }) => {
await dbExec(
@@ -35,7 +30,7 @@ export function OnboardingForm() {
value.aktueller_schritt,
],
);
navigate({ to: "/prozess" as string });
navigate({ to: "/onboarding" });
},
});
@@ -159,14 +154,17 @@ export function OnboardingForm() {
);
}
function FieldErrors({
errors,
}: {
errors: ReadonlyArray<string | undefined | { message: string }>;
}) {
function FieldErrors({ errors }: { errors: readonly unknown[] }) {
if (errors.length === 0) return null;
const messages = errors
.filter((e): e is string | { message: string } => e != null)
.map((e) => (typeof e === "string" ? e : e.message));
.map((e) =>
typeof e === "string"
? e
: typeof e === "object" && "message" in (e as Record<string, unknown>)
? (e as { message: string }).message
: String(e),
);
if (messages.length === 0) return null;
return <p className="text-sm text-destructive">{messages.join(", ")}</p>;
}