feat: full site build — Project/Melody schema (Option A), admin CRUD, public sections, uploads, email+SMTP, internal analytics, legal pages, docs
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import type { ReactNode } from "react";
|
||||
import { redirect } from "next/navigation";
|
||||
import AdminShell from "@/components/admin/admin-shell";
|
||||
import { auth, signOut } from "@/lib/auth";
|
||||
|
||||
export default async function AdminProtectedLayout({ children }: { children: ReactNode }) {
|
||||
const session = await auth();
|
||||
|
||||
if (!session?.user) {
|
||||
redirect("/admin/login");
|
||||
}
|
||||
|
||||
async function handleSignOut() {
|
||||
"use server";
|
||||
await signOut({ redirectTo: "/admin/login" });
|
||||
}
|
||||
|
||||
return (
|
||||
<AdminShell userEmail={session.user.email ?? "Admin"} signOutAction={handleSignOut}>
|
||||
{children}
|
||||
</AdminShell>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user