import { LogtoProvider } from '@logto/react'; import React, { useEffect } from 'react'; import { BrowserRouter, Navigate, Route, Routes, useLocation, useNavigate } from 'react-router-dom'; import { SWRConfig } from 'swr'; import './scss/normalized.scss'; import AppContent from './components/AppContent'; import { getPath, sections } from './components/AppContent/components/Sidebar'; import Toast from './components/Toast'; import { logtoApiResource } from './consts/api'; import useSwrFetcher from './hooks/use-swr-fetcher'; import initI18n from './i18n/init'; import ApiResourceDetails from './pages/ApiResourceDetails'; import ApiResources from './pages/ApiResources'; import ApplicationDetails from './pages/ApplicationDetails'; import Applications from './pages/Applications'; import Callback from './pages/Callback'; import ConnectorDetails from './pages/ConnectorDetails'; import Connectors from './pages/Connectors'; import GetStarted from './pages/GetStarted'; import UserDetails from './pages/UserDetails'; import Users from './pages/Users'; const isBasenameNeeded = process.env.NODE_ENV !== 'development' || process.env.PORT === '5002'; void initI18n(); const Main = () => { const location = useLocation(); const navigate = useNavigate(); const fetcher = useSwrFetcher(); useEffect(() => { if (location.pathname === '/') { navigate(getPath(sections[0]?.items[0]?.title ?? '')); } }, [location.pathname, navigate]); return ( } /> }> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> ); }; const App = () => (
); export default App;