You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.4 KiB
35 lines
1.4 KiB
import { lazy, Suspense } from 'react'
|
|
import { Routes, Route, Navigate, Outlet } from 'react-router-dom'
|
|
import { RouteProgressStart, PageReady } from './nprogress'
|
|
import RequireAuth from '@/features/auth/RequireAuth'
|
|
|
|
/* لود صفحات اصلی */
|
|
const LoginPage = lazy(() => import('@/features/auth/LoginPage'))
|
|
const DashboardHome = lazy(() => import('@/features/dashboard/DashboardHome'))
|
|
const ToursPage = lazy(() => import('@/features/tours/ToursPage'))
|
|
const TourOrdersPage = lazy(() => import('@/features/tours/TourOrdersPage'))
|
|
|
|
export default function AppRouter() {
|
|
return (
|
|
<>
|
|
<RouteProgressStart />
|
|
<Suspense fallback={null}>
|
|
<Routes>
|
|
{/* مسیر عمومی ورود به سیستم */}
|
|
<Route path="/login" element={<PageReady><LoginPage /></PageReady>} />
|
|
|
|
{/* تمام مسیرهای محافظتشده پشت گارد امنیتی */}
|
|
<Route element={<RequireAuth><Outlet /></RequireAuth>}>
|
|
<Route path="/" element={<PageReady><DashboardHome /></PageReady>} />
|
|
<Route path="/tours" element={<PageReady><ToursPage /></PageReady>} />
|
|
<Route path="/tours/orders" element={<PageReady><TourOrdersPage /></PageReady>} />
|
|
|
|
{/* هدایت مسیرهای ناشناخته به صفحه اصلی */}
|
|
<Route path="*" element={<Navigate to="/" replace />} />
|
|
</Route>
|
|
</Routes>
|
|
</Suspense>
|
|
</>
|
|
)
|
|
}
|
|
|