temp
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { getCurrentUser } from "@/lib/user";
|
||||
import { redirect } from "next/navigation";
|
||||
import CreateActClient from "./client";
|
||||
import { Metadata } from "next";
|
||||
import { getActTypes, getInstitutions, getRegions } from "@/lib/acts/repository";
|
||||
import { getPositions, getUserPositions } from "@/lib/positions/repository";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Create act",
|
||||
robots: { index: false, follow: false },
|
||||
};
|
||||
|
||||
export default async function CreateAct() {
|
||||
const user = await getCurrentUser();
|
||||
if (!user) redirect("/");
|
||||
|
||||
const [actTypes, institutions, regions, positions, userPositions] = await Promise.all([
|
||||
getActTypes(),
|
||||
getInstitutions(),
|
||||
getRegions(),
|
||||
getPositions(),
|
||||
getUserPositions(user.id),
|
||||
]);
|
||||
|
||||
if (userPositions.length === 0) {
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
return <CreateActClient actTypes={actTypes} institutions={institutions.filter((institution) => userPositions.some((position) => position.position.institutionId === institution.id))} regions={regions} positions={positions} />;
|
||||
}
|
||||
Reference in New Issue
Block a user