import { Routes, Route, Navigate, useLocation } from 'react-router-dom'; import { AuthProvider, useAuth } from './contexts/AuthContext'; import Layout from './components/Layout'; import Home from './pages/Home'; import ProjectPage from './pages/ProjectPage'; import PackagePage from './pages/PackagePage'; import Dashboard from './pages/Dashboard'; import LoginPage from './pages/LoginPage'; import ChangePasswordPage from './pages/ChangePasswordPage'; import APIKeysPage from './pages/APIKeysPage'; import AdminUsersPage from './pages/AdminUsersPage'; import AdminOIDCPage from './pages/AdminOIDCPage'; // Component that checks if user must change password function RequirePasswordChange({ children }: { children: React.ReactNode }) { const { user, loading } = useAuth(); const location = useLocation(); if (loading) { return null; } // If user is logged in and must change password, redirect to change password page if (user?.must_change_password && location.pathname !== '/change-password') { return ; } return <>{children}; } function AppRoutes() { return ( } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> ); } function App() { return ( ); } export default App;