forked from fahrPool/fahrPool
22 lines
839 B
TypeScript
22 lines
839 B
TypeScript
import { redirect } from "next/navigation";
|
|
import { loadProfile } from "@/lib/auth/profile";
|
|
import { kannStammdatenPflegen } from "@/lib/auth/roles";
|
|
import { listFahrzeuge } from "@/lib/auftraege/queries";
|
|
import { FahrzeugeTabelle } from "@/components/fahrzeuge/FahrzeugeTabelle";
|
|
|
|
export default async function FahrzeugePage() {
|
|
const profileResult = await loadProfile();
|
|
if (profileResult.status !== "ok" || !kannStammdatenPflegen(profileResult.profile.role)) {
|
|
redirect(`/auftraege?error=${encodeURIComponent("Nur Disponent/Admin duerfen Stammdaten pflegen.")}`);
|
|
}
|
|
|
|
const fahrzeuge = await listFahrzeuge();
|
|
|
|
return (
|
|
<div className="mx-auto max-w-4xl p-4 md:p-8">
|
|
<h1 className="mb-6 text-xl font-semibold text-asphalt-grey">Fahrzeuge</h1>
|
|
<FahrzeugeTabelle fahrzeuge={fahrzeuge} />
|
|
</div>
|
|
);
|
|
}
|