Files
threadcount-community/app/ops/(console)/layout.tsx
T
ThreadCount 344b1701dd ThreadCount Community edition
Uniform stock management for healthcare linen rooms. Licensed under the GNU AGPL v3.
2026-09-13 08:54:35 +10:00

21 lines
976 B
TypeScript

import { redirect } from "next/navigation";
import { currentOperator } from "@/lib/ops/session";
import { Rail } from "./Rail";
/* Everything in this group needs a signed-in operator. The sign-in page sits outside the group
* so it is reachable without one. The proxy already turned away requests with no valid tc_ops
* cookie; this re-reads the row, so a deactivated operator or a changed password ends the
* session here even if the token still verifies. */
export const dynamic = "force-dynamic";
export default async function ConsoleLayout({ children }: { children: React.ReactNode }) {
const op = await currentOperator();
if (!op) redirect("/ops/login");
return (
<div style={{ display: "flex", minHeight: "100vh", alignItems: "stretch" }}>
<Rail name={op.name} email={op.email} role={op.role} viaSso={op.viaSso} totpEnabled={op.totpEnabled} />
<main style={{ flex: 1, minWidth: 0, padding: "0 32px 32px" }}>{children}</main>
</div>
);
}