layout errer
This commit is contained in:
@@ -9,9 +9,10 @@ export const metadata = { title: "DMS | Protected" };
|
||||
const API_BASE = (process.env.NEXT_PUBLIC_API_BASE || "").replace(/\/$/, "");
|
||||
|
||||
async function fetchSessionFromAPI() {
|
||||
const cookieStore = await cookies(); // ✅ ต้อง await
|
||||
const cookieStore = await cookies(); // ✅ ต้อง await
|
||||
const cookieHeader = cookieStore.toString();
|
||||
const hdrs = await headers(); // ✅ ต้อง await
|
||||
|
||||
const hdrs = await headers(); // ✅ ต้อง await
|
||||
const hostHdr = hdrs.get("host");
|
||||
const protoHdr = hdrs.get("x-forwarded-proto") || "https";
|
||||
|
||||
@@ -46,10 +47,7 @@ export default async function ProtectedLayout({ children }) {
|
||||
<section className="grid grid-cols-12 gap-6 p-4 mx-auto max-w-7xl">
|
||||
<aside className="col-span-12 lg:col-span-3 xl:col-span-3">
|
||||
<div className="p-4 border rounded-3xl bg-white/70">
|
||||
<div className="mb-3 text-sm">
|
||||
RBAC: <b>{user.role}</b>
|
||||
</div>
|
||||
|
||||
<div className="mb-3 text-sm">RBAC: <b>{user.role}</b></div>
|
||||
<nav className="space-y-2">
|
||||
<Link className="block px-4 py-2 rounded-xl bg-white/60 hover:bg-white" href="/dashboard">แดชบอร์ด</Link>
|
||||
<Link className="block px-4 py-2 rounded-xl bg-white/60 hover:bg-white" href="/drawings">Drawings</Link>
|
||||
@@ -58,7 +56,6 @@ export default async function ProtectedLayout({ children }) {
|
||||
<Link className="block px-4 py-2 rounded-xl bg-white/60 hover:bg-white" href="/correspondences">Correspondences</Link>
|
||||
<Link className="block px-4 py-2 rounded-xl bg-white/60 hover:bg-white" href="/contracts-volumes">Contracts & Volumes</Link>
|
||||
<Link className="block px-4 py-2 rounded-xl bg-white/60 hover:bg-white" href="/reports">Reports</Link>
|
||||
|
||||
{can(user, "workflow:view") && <Link className="block px-4 py-2 rounded-xl bg-white/60 hover:bg-white" href="/workflow">Workflow (n8n)</Link>}
|
||||
{can(user, "health:view") && <Link className="block px-4 py-2 rounded-xl bg-white/60 hover:bg-white" href="/health">Health</Link>}
|
||||
{can(user, "users:manage") && <Link className="block px-4 py-2 rounded-xl bg-white/60 hover:bg-white" href="/users">ผู้ใช้/บทบาท</Link>}
|
||||
@@ -67,12 +64,8 @@ export default async function ProtectedLayout({ children }) {
|
||||
</aside>
|
||||
|
||||
<main className="col-span-12 space-y-6 lg:col-span-9 xl:col-span-9">
|
||||
{/* System / Quick Actions */}
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="flex-1 text-lg font-semibold">
|
||||
Document Management System — LCBP3 Phase 3
|
||||
</div>
|
||||
|
||||
<div className="flex-1 text-lg font-semibold">Document Management System — LCBP3 Phase 3</div>
|
||||
{can(user, "admin:view") && <a className="px-3 py-2 text-white rounded-xl" style={{ background: "#0D5C75" }} href="/admin">Admin</a>}
|
||||
{can(user, "users:manage") && <a className="px-3 py-2 text-white rounded-xl" style={{ background: "#0D5C75" }} href="/users">ผู้ใช้/บทบาท</a>}
|
||||
{can(user, "health:view") && <a className="px-3 py-2 text-white rounded-xl" style={{ background: "#0D5C75" }} href="/health">Health</a>}
|
||||
|
||||
Reference in New Issue
Block a user