protect /setup and use links for button

This commit is contained in:
Milo Schwartz
2024-11-26 20:30:52 -05:00
parent 7c9e57ef12
commit 41e531306d
11 changed files with 48 additions and 63 deletions

View File

@@ -1,4 +1,7 @@
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`,
@@ -10,5 +13,12 @@ export default async function SetupLayout({
}: {
children: React.ReactNode;
}) {
const getUser = cache(verifySession);
const user = await getUser();
if (!user) {
redirect("/");
}
return <div className="mt-32">{children}</div>;
}