From f696293e91050147da5877e51656cd691616f0c9 Mon Sep 17 00:00:00 2001 From: "Zachariah K. Sharma" Date: Sat, 13 Jun 2026 11:53:55 -0600 Subject: [PATCH] Guard forms dashboard session --- src/app/app/page.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/app/page.tsx b/src/app/app/page.tsx index 59970ee..cff2ccc 100644 --- a/src/app/app/page.tsx +++ b/src/app/app/page.tsx @@ -1,4 +1,5 @@ import Link from "next/link"; +import { redirect } from "next/navigation"; import { auth } from "@/lib/auth"; import { prisma } from "@/lib/db"; import { createForm, createFromTemplate } from "@/lib/actions"; @@ -10,8 +11,9 @@ import { Plus, FileText, Layers } from "lucide-react"; export default async function FormsList({ searchParams }: { searchParams: Promise<{ tag?: string }> }) { const { tag: tagFilter } = await searchParams; const session = await auth(); - const userId = session!.user.id; - const isAdmin = session!.user.role === "admin"; + if (!session?.user) redirect("/signin"); + const userId = session.user.id; + const isAdmin = session.user.role === "admin"; const baseWhere = isAdmin ? {} : { OR: [