feat(admin): implement Phase 3 Admin SPA Router and Dual-Token Auth integration
This commit is contained in:
1 parent
71e19bfe43
commit
eaa2621a17
11 files changed
+561
-153
No files matched your search
@@ -1,55 +1,27 @@
|
||||
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
||||
import { Suspense } from 'react';
|
||||
import { RouterProvider } from 'react-router-dom';
|
||||
import { Toaster } from 'react-hot-toast';
|
||||
import Layout from './components/Layout';
|
||||
import Dashboard from './pages/Dashboard';
|
||||
import Login from './pages/Login';
|
||||
import ProtectedRoute from './components/ProtectedRoute';
|
||||
import Users from './pages/Users';
|
||||
import Products from './pages/Products';
|
||||
import Orders from './pages/Orders';
|
||||
import Coupons from './pages/Coupons';
|
||||
import Settings from './pages/Settings';
|
||||
import Reports from './pages/Reports';
|
||||
import Categories from './pages/Categories';
|
||||
import Blogs from './pages/Blogs';
|
||||
import Wiki from './pages/Wiki';
|
||||
import Pets from './pages/Pets';
|
||||
import UITexts from './pages/UITexts';
|
||||
import Media from './pages/Media';
|
||||
import CMS from './pages/CMS';
|
||||
import WholesaleApplications from './pages/WholesaleApplications';
|
||||
import Videos from './pages/Videos';
|
||||
import ContactSubmissions from './pages/ContactSubmissions';
|
||||
import { router } from './routes/adminRoutes';
|
||||
|
||||
function SuspenseFallback() {
|
||||
return (
|
||||
<div className="min-h-screen flex items-center justify-center bg-gray-50 font-vazir" dir="rtl">
|
||||
<div className="flex flex-col items-center gap-3">
|
||||
<div className="w-10 h-10 border-4 border-purple-600 border-t-transparent rounded-full animate-spin"></div>
|
||||
<span className="text-sm font-bold text-gray-500">در حال بارگذاری ماژول ادمین...</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<BrowserRouter>
|
||||
<>
|
||||
<Toaster position="top-center" toastOptions={{ className: 'font-vazir' }} />
|
||||
<Routes>
|
||||
<Route path="/login" element={<Login />} />
|
||||
<Route element={<ProtectedRoute />}>
|
||||
<Route path="/" element={<Layout />}>
|
||||
<Route index element={<Dashboard />} />
|
||||
<Route path="users" element={<Users />} />
|
||||
<Route path="products" element={<Products />} />
|
||||
<Route path="orders" element={<Orders />} />
|
||||
<Route path="coupons" element={<Coupons />} />
|
||||
<Route path="settings" element={<Settings />} />
|
||||
<Route path="reports" element={<Reports />} />
|
||||
<Route path="categories" element={<Categories />} />
|
||||
<Route path="blogs" element={<Blogs />} />
|
||||
<Route path="wiki" element={<Wiki />} />
|
||||
<Route path="videos" element={<Videos />} />
|
||||
<Route path="pets" element={<Pets />} />
|
||||
<Route path="ui-texts" element={<UITexts />} />
|
||||
<Route path="media" element={<Media />} />
|
||||
<Route path="cms" element={<CMS />} />
|
||||
<Route path="wholesale" element={<WholesaleApplications />} />
|
||||
<Route path="contact" element={<ContactSubmissions />} />
|
||||
</Route>
|
||||
</Route>
|
||||
</Routes>
|
||||
</BrowserRouter>
|
||||
<Suspense fallback={<SuspenseFallback />}>
|
||||
<RouterProvider router={router} />
|
||||
</Suspense>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user