From 50be52f08aa01f41898013582e804078181ded77 Mon Sep 17 00:00:00 2001 From: Taken Date: Thu, 26 Jun 2025 23:36:15 +0200 Subject: [PATCH] Auth fix --- src/app/(admin)/dashboard/create/page.tsx | 9 ++++++++- src/app/(admin)/dashboard/list/page.tsx | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/app/(admin)/dashboard/create/page.tsx b/src/app/(admin)/dashboard/create/page.tsx index a410564..7982003 100644 --- a/src/app/(admin)/dashboard/create/page.tsx +++ b/src/app/(admin)/dashboard/create/page.tsx @@ -1,6 +1,13 @@ import { AdvancedUrlFormCard } from "@/components/dashboard/advanced-url-form-card" +import { getSession } from "@/lib/auth/session" + +export default async function DashboardCreatePage() { + const { session, redirect } = await getSession() + + if (!session) { + redirect("/sign-in") + } -export default function DashboardCreatePage() { return (
diff --git a/src/app/(admin)/dashboard/list/page.tsx b/src/app/(admin)/dashboard/list/page.tsx index dfee573..5c7d1fb 100644 --- a/src/app/(admin)/dashboard/list/page.tsx +++ b/src/app/(admin)/dashboard/list/page.tsx @@ -1,7 +1,14 @@ import { UrlsDataTable } from "@/components/dashboard/urls-data-table" +import { getSession } from "@/lib/auth/session" import { getAllUrls } from "@/lib/db/urls" export default async function DashboardListPage() { + const { session, redirect } = await getSession() + + if (!session) { + redirect("/sign-in") + } + const urls = await getAllUrls() return (