23 lines
775 B
TypeScript
23 lines
775 B
TypeScript
import { notFound, redirect } from "next/navigation";
|
|
import { connection } from "next/server";
|
|
|
|
import { EditorWorkspace } from "@/components/admin/editor-workspace";
|
|
import { getAdminSession } from "@/lib/auth/server";
|
|
import { loadAdminNavigation, loadAdminPage } from "@/lib/content/loaders";
|
|
|
|
export default async function AdminEditorPage({
|
|
params,
|
|
}: {
|
|
params: Promise<{ character: string; page: string }>;
|
|
}) {
|
|
await connection();
|
|
if (!(await getAdminSession())) redirect("/admin/login");
|
|
const { character, page } = await params;
|
|
const [snapshot, navigation] = await Promise.all([
|
|
loadAdminPage(character, page),
|
|
loadAdminNavigation(),
|
|
]);
|
|
if (!snapshot) notFound();
|
|
return <EditorWorkspace snapshot={snapshot} navigation={navigation} />;
|
|
}
|