Added loginPage

This commit is contained in:
choizhang
2025-03-11 14:48:19 +08:00
parent 8317ec9757
commit 6b22e8065b
10 changed files with 239 additions and 7 deletions

View File

@@ -0,0 +1,40 @@
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom'
// import { useAuthStore } from '@/stores/state'
import { Toaster } from 'sonner'
import App from './App'
import LoginPage from '@/features/LoginPage'
interface ProtectedRouteProps {
children: React.ReactNode
}
const ProtectedRoute = ({ children }: ProtectedRouteProps) => {
// const { isAuthenticated } = useAuthStore()
// if (!isAuthenticated) {
// return <Navigate to="/login" replace />
// }
return <>{children}</>
}
const AppRouter = () => {
return (
<BrowserRouter>
<Routes>
<Route path="/login" element={<LoginPage />} />
<Route
path="/*"
element={
<ProtectedRoute>
<App />
</ProtectedRoute>
}
/>
</Routes>
<Toaster position="top-center" />
</BrowserRouter>
)
}
export default AppRouter