fix: centralize protected page access
This commit is contained in:
1 parent
844b8f7afd
commit
e328267763
11 files changed
+132
-25
No files matched your search
@@ -1,9 +1,7 @@
|
||||
import Link from "next/link";
|
||||
import { Plus, Play, Trash2, ArrowLeft } from "lucide-react";
|
||||
import { notFound } from "next/navigation";
|
||||
import { headers } from "next/headers";
|
||||
|
||||
import { requireAdmin } from "@/modules/auth/principal";
|
||||
import { autoRuleService } from "@/modules/albums/auto-rules";
|
||||
import { db } from "@/db/client";
|
||||
import { editorialAccounts } from "@/db/schema";
|
||||
@@ -14,6 +12,7 @@ import { Input } from "@/components/ui/input";
|
||||
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card";
|
||||
import { PageHeader } from "@/components/ui/page-header";
|
||||
|
||||
import { requireAdminPage } from "../../../access";
|
||||
import { applyAutoRulesAction, createAutoRuleAction, deleteAutoRuleAction } from "./actions";
|
||||
|
||||
type AutoRulesPageProps = Readonly<{
|
||||
@@ -21,7 +20,7 @@ type AutoRulesPageProps = Readonly<{
|
||||
}>;
|
||||
|
||||
export default async function AutoRulesPage({ params }: AutoRulesPageProps) {
|
||||
await requireAdmin(new Headers(await headers()));
|
||||
await requireAdminPage();
|
||||
const { id } = await params;
|
||||
|
||||
const [editorial] = await db
|
||||
|
||||
Reference in new issue
Block a user