mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-30 14:39:29 +02:00
34 lines
768 B
TypeScript
34 lines
768 B
TypeScript
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`,
|
|
description: ""
|
|
};
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export default async function SetupLayout({
|
|
children
|
|
}: {
|
|
children: React.ReactNode;
|
|
}) {
|
|
const getUser = cache(verifySession);
|
|
const user = await getUser();
|
|
|
|
if (!user) {
|
|
redirect("/?redirect=/setup");
|
|
}
|
|
|
|
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>
|
|
);
|
|
}
|