1
0
Fork 0
fahrPool/web/app/profil/page.tsx

30 lines
1.0 KiB
TypeScript

import { redirect } from "next/navigation";
import { loadProfile } from "@/lib/auth/profile";
import { ladeDetails } from "@/lib/nutzerverwaltung/details-queries";
import { ProfilForm } from "@/components/profil/ProfilForm";
import { Card } from "@/components/ui/Card";
export default async function ProfilPage() {
const profileResult = await loadProfile();
if (profileResult.status !== "ok") {
redirect("/login");
}
const istSuperadmin = profileResult.profile.role === "superadmin";
const details = istSuperadmin ? undefined : await ladeDetails(profileResult.profile.id);
return (
<div className="mx-auto max-w-2xl p-4 md:p-8">
<h1 className="mb-1 text-xl font-semibold text-asphalt-grey">Mein Profil</h1>
<p className="mb-6 text-asphalt-grey">{profileResult.profile.name}</p>
<Card>
{!details ? (
<p className="text-asphalt-grey">Für den Plattform-Zugang gibt es keine Kontaktdaten.</p>
) : (
<ProfilForm details={details} />
)}
</Card>
</div>
);
}