344b1701dd
Uniform stock management for healthcare linen rooms. Licensed under the GNU AGPL v3.
17 lines
760 B
TypeScript
17 lines
760 B
TypeScript
import { redirect } from "next/navigation";
|
|
import { currentUser } from "@/lib/session";
|
|
import { buildSnapshot } from "@/lib/snapshot";
|
|
import { SnapshotProvider } from "@/lib/client";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
/* Everything that needs a signed-in coordinator. Sending them to /m/login rather than /auth keeps
|
|
them in the app's own world: /auth is the website's two-pane sign-in, which is a jarring thing
|
|
to meet on a phone halfway through opening an app. */
|
|
export default async function MobileAppLayout({ children }: { children: React.ReactNode }) {
|
|
const user = await currentUser();
|
|
if (!user) redirect("/m/login");
|
|
const snap = await buildSnapshot(user);
|
|
return <SnapshotProvider snap={snap}>{children}</SnapshotProvider>;
|
|
}
|