Stay on the view after page reload

This commit is contained in:
AG
2025-12-12 21:01:45 +02:00
parent 7d82444e94
commit 48da187660

View File

@@ -13,7 +13,7 @@ import { getSystemLanguage } from './services/i18n';
import { useAuth } from './context/AuthContext';
function App() {
const { currentUser, updateUser, logout } = useAuth();
const { currentUser, updateUser, logout, isLoading } = useAuth();
const [language, setLanguage] = useState<Language>('en');
const navigate = useNavigate();
@@ -37,6 +37,14 @@ function App() {
navigate('/login');
};
if (isLoading) {
return (
<div className="h-[100dvh] w-screen bg-surface flex items-center justify-center text-on-surface">
<div className="animate-pulse">Loading...</div>
</div>
);
}
if (!currentUser && location.pathname !== '/login') {
return <Navigate to="/login" />;
}