feat: citizenship applications
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import Footer from "@/components/footer";
|
||||
import Header from "@/components/header";
|
||||
import { getCurrentUser } from "@/lib/user";
|
||||
import { redirect } from "next/navigation";
|
||||
import { AccountMenu } from "../../menu";
|
||||
import { CitizenshipApplicationForm } from "./form";
|
||||
import { getUserApplications } from "@/lib/citizenship/repository";
|
||||
|
||||
export default async function CitizenshipApplication() {
|
||||
const user = await getCurrentUser();
|
||||
if (!user) redirect("/");
|
||||
|
||||
const applications = await getUserApplications(user.id);
|
||||
const canApply = applications.length === 0 || applications.every((a) => a.status === "REJECTED");
|
||||
if (!canApply) redirect("/account/citizenship");
|
||||
|
||||
return (
|
||||
<>
|
||||
<Header />
|
||||
<div className="flex flex-row py-16 gap-8">
|
||||
<AccountMenu />
|
||||
<div className="flex flex-col gap-8">
|
||||
<div className="flex flex-col gap-6">
|
||||
<h2>Citizenship application</h2>
|
||||
<div className="w-96 flex flex-col gap-6">
|
||||
<CitizenshipApplicationForm
|
||||
firstName={user.firstName}
|
||||
secondName={user.secondName}
|
||||
sex={user.sex}
|
||||
birthDate={user.birthDate}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Footer />
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user