mirror of
https://github.com/formbricks/formbricks.git
synced 2026-05-03 11:30:50 -05:00
ab80bc1bf2
Co-authored-by: Johannes <johannes@formbricks.com> Co-authored-by: Matti Nannt <mail@matthiasnannt.com>
18 lines
589 B
TypeScript
18 lines
589 B
TypeScript
import { getServerSession } from "next-auth";
|
|
import { notFound } from "next/navigation";
|
|
import { authOptions } from "@formbricks/lib/authOptions";
|
|
import { getIsFreshInstance } from "@formbricks/lib/instance/service";
|
|
|
|
const FreshInstanceLayout = async ({ children }: { children: React.ReactNode }) => {
|
|
const session = await getServerSession(authOptions);
|
|
const isFreshInstance = await getIsFreshInstance();
|
|
|
|
if (session || !isFreshInstance) {
|
|
return notFound();
|
|
}
|
|
if (!isFreshInstance) return notFound();
|
|
return <>{children}</>;
|
|
};
|
|
|
|
export default FreshInstanceLayout;
|