Compare commits
26
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0017aff5f4 | ||
|
|
e52776e68a | ||
|
|
cd06a71a9e | ||
|
|
0fcd93cb7d | ||
|
|
3470853858 | ||
|
|
ff9a02c020 | ||
|
|
f81a7c334e | ||
|
|
2700f7cbb7 | ||
|
|
cfcdfa527c | ||
|
|
c6579d5295 | ||
|
|
a1640cfe1d | ||
|
|
00df69fb93 | ||
|
|
810dbaa0ca | ||
|
|
cb09709800 | ||
|
|
7e385c6385 | ||
|
|
19aa5bb452 | ||
|
|
e8de897dc9 | ||
|
|
eff89d28ed | ||
|
|
b75a88677a | ||
|
|
7642fef3e6 | ||
|
|
f40e0e35b9 | ||
|
|
c6c0d6fded | ||
|
|
fcaa449630 | ||
|
|
4988980384 | ||
|
|
9547d34f5c | ||
|
|
aeb23a7255 |
@@ -1,9 +1,4 @@
|
|||||||
import {
|
import { Outlet, ScrollRestoration, useLocation, useNavigate } from 'react-router-dom';
|
||||||
Outlet,
|
|
||||||
ScrollRestoration,
|
|
||||||
useLocation,
|
|
||||||
useNavigate,
|
|
||||||
} from 'react-router-dom';
|
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { supabase } from '@imphnen-frontend-service/service';
|
import { supabase } from '@imphnen-frontend-service/service';
|
||||||
|
|
||||||
@@ -32,21 +27,14 @@ export default function RootLayout() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check Supabase session
|
// Check Supabase session
|
||||||
const {
|
const { data: { session }, error } = await supabase.auth.getSession();
|
||||||
data: { session },
|
|
||||||
error,
|
|
||||||
} = await supabase.auth.getSession();
|
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error('[Layout] Session error:', error);
|
console.error('[Layout] Session error:', error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Public auth pages (login, signup, forgot-password, reset-password) - allow unauthenticated access
|
// Public auth pages (login, signup, forgot-password, reset-password) - allow unauthenticated access
|
||||||
const isPublicAuthPage = pathname === '/maintenance';
|
const isPublicAuthPage = pathname === '/auth/login' || pathname === '/auth/signup' || pathname === '/auth/forgot-password' || pathname === '/auth/reset-password';
|
||||||
// pathname === '/auth/login' ||
|
|
||||||
// pathname === '/auth/signup' ||
|
|
||||||
// pathname === '/auth/forgot-password' ||
|
|
||||||
// pathname === '/auth/reset-password';
|
|
||||||
|
|
||||||
if (isPublicAuthPage) {
|
if (isPublicAuthPage) {
|
||||||
// If already authenticated and not on password reset pages, redirect to dashboard
|
// If already authenticated and not on password reset pages, redirect to dashboard
|
||||||
@@ -68,8 +56,7 @@ export default function RootLayout() {
|
|||||||
|
|
||||||
// Require authentication for all other routes
|
// Require authentication for all other routes
|
||||||
if (!session) {
|
if (!session) {
|
||||||
navigate('/maintenance', { replace: true });
|
navigate('/auth/login', { replace: true });
|
||||||
// navigate('/auth/login', { replace: true });
|
|
||||||
setIsChecking(false);
|
setIsChecking(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
export default function MaintenancePage() {
|
|
||||||
return (
|
|
||||||
<div className="flex justify-center items-center min-h-screen bg-gray-50 dark:bg-gray-950 px-4">
|
|
||||||
<div className="text-center">
|
|
||||||
<h1 className="text-6xl font-bold text-yellow-600 mb-4">🚧</h1>
|
|
||||||
<h2 className="text-3xl font-semibold mb-2">We'll be back soon!</h2>
|
|
||||||
<p className="text-gray-600">
|
|
||||||
Our site is currently undergoing scheduled maintenance.
|
|
||||||
<br />
|
|
||||||
Thank you for your patience.
|
|
||||||
</p>
|
|
||||||
<a
|
|
||||||
href="/"
|
|
||||||
className="mt-4 inline-block text-primary-600 hover:underline"
|
|
||||||
>
|
|
||||||
Back to Homepage
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user