添加了相关测试文件,引入Tailwindcss
Change-Id: I12054143571bb688590af0357125a0ed26ff2050
diff --git a/src/routes/index.jsx b/src/routes/index.jsx
new file mode 100644
index 0000000..66e5838
--- /dev/null
+++ b/src/routes/index.jsx
@@ -0,0 +1,48 @@
+import { createBrowserRouter } from 'react-router-dom';
+import App from '../App';
+import Login from '../pages/Login';
+import Register from '../pages/Register';
+import NotFound from '../pages/NotFound';
+import Unauthorized from '../pages/Unauthorized';
+import AdminPanel from '../pages/AdminPanel';
+import ProtectedRoute from './protectedroute';
+import PermissionRoute from './PermissionRoute';
+
+const router = createBrowserRouter([
+ {
+ path: '/',
+ element: (
+ <ProtectedRoute>
+ <App />
+ </ProtectedRoute>
+ ),
+ },
+ {
+ path: '/login',
+ element: <Login />,
+ },
+ {
+ path: '/register',
+ element: <Register />,
+ },
+ {
+ path: '/unauthorized',
+ element: <Unauthorized />,
+ },
+ {
+ path: '/admin',
+ element: (
+ <ProtectedRoute>
+ <PermissionRoute requiredRoles={['admin']}>
+ <AdminPanel />
+ </PermissionRoute>
+ </ProtectedRoute>
+ ),
+ },
+ {
+ path: '*',
+ element: <NotFound />,
+ },
+]);
+
+export default router;
\ No newline at end of file