fosrl.pangolin/src/app/setup/layout.tsx

35 lines
768 B
TypeScript
Raw Normal View History

import { verifySession } from "@app/lib/auth/verifySession";
import { Metadata } from "next";
import { redirect } from "next/navigation";
import { cache } from "react";
export const metadata: Metadata = {
title: `Setup - Pangolin`,
2024-12-21 14:11:10 -05:00
description: ""
};
export const dynamic = "force-dynamic";
2024-10-19 16:37:40 -04:00
export default async function SetupLayout({
2024-12-21 14:11:10 -05:00
children
2024-10-19 16:37:40 -04:00
}: {
children: React.ReactNode;
}) {
const getUser = cache(verifySession);
const user = await getUser();
if (!user) {
2024-11-28 00:11:13 -05:00
redirect("/?redirect=/setup");
}
2024-12-25 15:54:32 -05:00
if (
!(process.env.DISABLE_USER_CREATE_ORG === "false" || user.serverAdmin)
) {
redirect("/");
}
return (
<div className="w-full max-w-2xl mx-auto p-3 md:mt-32">{children}</div>
);
2024-10-19 16:37:40 -04:00
}