diff --git a/app/api/quotes/route.ts b/app/api/quotes/route.ts index 1381192..e4330fd 100644 --- a/app/api/quotes/route.ts +++ b/app/api/quotes/route.ts @@ -1,11 +1,11 @@ import { NextRequest, NextResponse } from "next/server" import { getAllQuotes, updateQuoteStatus, type QuoteStatus } from "@/lib/db" -import { getCurrentUser } from "@/lib/auth" +import { checkAuth } from "@/lib/auth" export async function GET() { try { - const user = await getCurrentUser() - if (!user) { + const { authenticated } = await checkAuth() + if (!authenticated) { return NextResponse.json({ error: "Ikke autoriseret" }, { status: 401 }) } @@ -18,8 +18,8 @@ export async function GET() { export async function PATCH(request: NextRequest) { try { - const user = await getCurrentUser() - if (!user) { + const { authenticated } = await checkAuth() + if (!authenticated) { return NextResponse.json({ error: "Ikke autoriseret" }, { status: 401 }) } diff --git a/components/calculator/calculator-form.tsx b/components/calculator/calculator-form.tsx index 87fdfdd..4addb4b 100644 --- a/components/calculator/calculator-form.tsx +++ b/components/calculator/calculator-form.tsx @@ -37,11 +37,11 @@ const formSchema = z.object({ .length(4, "Postnummer skal være 4 cifre") .refine(validateDanishPostalCode, "Ugyldigt dansk postnummer"), address: z.string().optional(), - area: z.coerce + area: z .number() .min(CONSTRAINTS.MIN_AREA, `Minimum areal er ${CONSTRAINTS.MIN_AREA} m²`) .max(CONSTRAINTS.MAX_AREA, `Maximum areal er ${CONSTRAINTS.MAX_AREA} m²`), - height: z.coerce + height: z .number() .min(CONSTRAINTS.MIN_HEIGHT, `Minimum højde er ${CONSTRAINTS.MIN_HEIGHT} cm`) .max(CONSTRAINTS.MAX_HEIGHT, `Maximum højde er ${CONSTRAINTS.MAX_HEIGHT} cm`), diff --git a/components/calculator/step-wizard.tsx b/components/calculator/step-wizard.tsx index 132cb00..4ee4437 100644 --- a/components/calculator/step-wizard.tsx +++ b/components/calculator/step-wizard.tsx @@ -37,11 +37,11 @@ const formSchema = z.object({ .length(4, "Postnummer skal være 4 cifre") .refine(validateDanishPostalCode, "Vi dækker desværre ikke dette område"), address: z.string().optional(), - area: z.coerce + area: z .number() .min(CONSTRAINTS.MIN_AREA, `Minimum ${CONSTRAINTS.MIN_AREA} m²`) .max(CONSTRAINTS.MAX_AREA, `Maximum ${CONSTRAINTS.MAX_AREA} m²`), - height: z.coerce + height: z .number() .min(CONSTRAINTS.MIN_HEIGHT, `Minimum ${CONSTRAINTS.MIN_HEIGHT} cm`) .max(CONSTRAINTS.MAX_HEIGHT, `Maximum ${CONSTRAINTS.MAX_HEIGHT} cm`),