diff --git a/src/app/page.tsx b/src/app/page.tsx index 361c8d2..6314119 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,30 +1,33 @@ -"use client"; -import Image from "next/image"; +import { auth0 } from "@/lib/auth0"; +import './globals.css'; -function Mobile() { - return ( -
-
-

- Welcome to Mobile.s! -

-
-
- ); -} +export default async function Home() { + // Fetch the user session + const session = await auth0.getSession(); -function Web() { - return ( -
-
-

- Welcome to Web.s! -

-
-
- ); -} + // If no session, show sign-up and login buttons + if (!session) { + return ( +
+ + + + + + +
+ ); + } -export default function Home() { - return Mobile(); -} + // If session exists, show a welcome message and logout button + return ( +
+

Welcome, {session.user.name}!

+

+ + + +

+
+ ); +} \ No newline at end of file diff --git a/src/middleware.ts b/src/middleware.ts index fd65d1c..6b63ae0 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -1,5 +1,5 @@ import type { NextRequest } from "next/server"; -import { auth0 } from "./lib/auth0" +import { auth0 } from "./lib/auth0"; export async function middleware(request: NextRequest) { return await auth0.middleware(request);