diff --git a/src/app/(external-pages)/page.tsx b/src/app/(external-pages)/page.tsx
deleted file mode 100644
index 63415eaa..00000000
--- a/src/app/(external-pages)/page.tsx
+++ /dev/null
@@ -1,5 +0,0 @@
-import { LandingPage } from '@/components/LandingPage';
-
-export default function Page() {
- return ;
-}
diff --git a/src/app/logout/page.tsx b/src/app/logout/page.tsx
index 305b6035..52cbe8f3 100644
--- a/src/app/logout/page.tsx
+++ b/src/app/logout/page.tsx
@@ -1,15 +1,15 @@
'use client';
import { T } from '@/components/ui/Typography';
import { supabaseUserClientComponentClient } from '@/supabase-clients/user/supabaseUserClientComponentClient';
-import { useDidMount } from 'rooks';
import { useRouter } from 'next/navigation';
+import { useDidMount } from 'rooks';
export default function Logout() {
const router = useRouter();
useDidMount(async () => {
await supabaseUserClientComponentClient.auth.signOut();
router.refresh();
- router.replace('/');
+ router.replace('/login');
});
return Signing out...;
diff --git a/src/app/route.ts b/src/app/route.ts
new file mode 100644
index 00000000..778f1a41
--- /dev/null
+++ b/src/app/route.ts
@@ -0,0 +1,33 @@
+import { createSupabaseUserRouteHandlerClient } from '@/supabase-clients/user/createSupabaseUserRouteHandlerClient';
+import { NextResponse } from 'next/server';
+
+export const dynamic = 'force-dynamic';
+
+export async function GET() {
+ const supabase = createSupabaseUserRouteHandlerClient();
+
+ const {
+ data: { user },
+ error,
+ } = await supabase.auth.getUser();
+
+ if (error) {
+ console.error('Error checking user authentication:', error);
+ // In case of an error, redirect to login as a fallback
+ return NextResponse.redirect(
+ new URL('/login', process.env.NEXT_PUBLIC_SITE_URL),
+ );
+ }
+
+ if (user) {
+ // User is logged in, redirect to dashboard
+ return NextResponse.redirect(
+ new URL('/dashboard', process.env.NEXT_PUBLIC_SITE_URL),
+ );
+ } else {
+ // User is not logged in, redirect to login
+ return NextResponse.redirect(
+ new URL('/login', process.env.NEXT_PUBLIC_SITE_URL),
+ );
+ }
+}