@@ -21,31 +21,33 @@ const copy = {
|
||||
};
|
||||
|
||||
type RootPortfolioPageProps = {
|
||||
searchParams?: {
|
||||
searchParams?: Promise<{
|
||||
category?: string;
|
||||
status?: "all" | "draft" | "published";
|
||||
success?: string;
|
||||
error?: string;
|
||||
};
|
||||
}>;
|
||||
};
|
||||
|
||||
export default async function RootPortfolioPage({ searchParams }: RootPortfolioPageProps) {
|
||||
if (!isAdminAuthenticated()) {
|
||||
const resolvedSearchParams = await searchParams;
|
||||
|
||||
if (!(await isAdminAuthenticated())) {
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
async function logoutAction() {
|
||||
"use server";
|
||||
|
||||
clearAdminSessionCookie();
|
||||
await clearAdminSessionCookie();
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
const selectedCategory = searchParams?.category && searchParams.category !== "__all__"
|
||||
? searchParams.category
|
||||
const selectedCategory = resolvedSearchParams?.category && resolvedSearchParams.category !== "__all__"
|
||||
? resolvedSearchParams.category
|
||||
: "";
|
||||
const selectedStatus = searchParams?.status === "draft" || searchParams?.status === "published"
|
||||
? searchParams.status
|
||||
const selectedStatus = resolvedSearchParams?.status === "draft" || resolvedSearchParams?.status === "published"
|
||||
? resolvedSearchParams.status
|
||||
: "all";
|
||||
const [categories, projects] = await Promise.all([
|
||||
getAdminPortfolioCategories(),
|
||||
|
||||
Reference in New Issue
Block a user