import Link from "next/link"; import { loadProfile } from "@/lib/auth/profile"; import { listAuftraegeFuerListe } from "@/lib/auftraege/queries"; import { AuftragListe } from "@/components/AuftragListe"; export default async function AuftraegePage({ searchParams, }: { searchParams: Promise<{ error?: string }>; }) { const { error } = await searchParams; const profileResult = await loadProfile(); if (profileResult.status !== "ok") { return null; } const { meine, offene, alle } = await listAuftraegeFuerListe(profileResult.profile); const istFahrer = profileResult.profile.role === "fahrer"; const kannAnlegen = profileResult.profile.role === "admin" || profileResult.profile.role === "disponent"; return (

Aufträge

{error &&

{error}

} {kannAnlegen && Neuen Auftrag anlegen} {istFahrer ? ( <> ) : ( )}
); }