From 11e32f4a24d40049753402a39f09d9eccadc38bf Mon Sep 17 00:00:00 2001 From: ngc2207 Date: Sun, 2 Feb 2025 01:32:15 +0800 Subject: [PATCH] feat(dashboard): add protected dashboard homepage --- src/app/(dashboard)/page.tsx | 14 +++++ src/app/page.tsx | 101 ----------------------------------- 2 files changed, 14 insertions(+), 101 deletions(-) create mode 100644 src/app/(dashboard)/page.tsx delete mode 100644 src/app/page.tsx diff --git a/src/app/(dashboard)/page.tsx b/src/app/(dashboard)/page.tsx new file mode 100644 index 0000000..84e935f --- /dev/null +++ b/src/app/(dashboard)/page.tsx @@ -0,0 +1,14 @@ +import { redirect } from "next/navigation"; +import { getCurrent } from "@/features/auth/actions"; + +export default async function HomePage() { + const user = await getCurrent(); + + if (!user) redirect("/sign-in"); + + return ( +
+ This is a home page +
+ ); +} diff --git a/src/app/page.tsx b/src/app/page.tsx deleted file mode 100644 index 3eee014..0000000 --- a/src/app/page.tsx +++ /dev/null @@ -1,101 +0,0 @@ -import Image from "next/image"; - -export default function Home() { - return ( -
-
- Next.js logo -
    -
  1. - Get started by editing{" "} - - src/app/page.tsx - - . -
  2. -
  3. Save and see your changes instantly.
  4. -
- -
- - Vercel logomark - Deploy now - - - Read our docs - -
-
- -
- ); -}