|
@@ -21,10 +21,11 @@ import React, { lazy, Suspense } from 'react';
|
|
|
import { Route, Routes, useLocation } from 'react-router-dom';
|
|
import { Route, Routes, useLocation } from 'react-router-dom';
|
|
|
import Loading from './components/common/ui/Loading.js';
|
|
import Loading from './components/common/ui/Loading.js';
|
|
|
import User from './pages/User';
|
|
import User from './pages/User';
|
|
|
-import { AuthRedirect, PrivateRoute } from './helpers';
|
|
|
|
|
|
|
+import { AuthRedirect, PrivateRoute, AdminRoute } from './helpers';
|
|
|
import RegisterForm from './components/auth/RegisterForm.js';
|
|
import RegisterForm from './components/auth/RegisterForm.js';
|
|
|
import LoginForm from './components/auth/LoginForm.js';
|
|
import LoginForm from './components/auth/LoginForm.js';
|
|
|
import NotFound from './pages/NotFound';
|
|
import NotFound from './pages/NotFound';
|
|
|
|
|
+import Forbidden from './pages/Forbidden';
|
|
|
import Setting from './pages/Setting';
|
|
import Setting from './pages/Setting';
|
|
|
|
|
|
|
|
import PasswordResetForm from './components/auth/PasswordResetForm.js';
|
|
import PasswordResetForm from './components/auth/PasswordResetForm.js';
|
|
@@ -72,20 +73,24 @@ function App() {
|
|
|
</Suspense>
|
|
</Suspense>
|
|
|
}
|
|
}
|
|
|
/>
|
|
/>
|
|
|
|
|
+ <Route
|
|
|
|
|
+ path='/forbidden'
|
|
|
|
|
+ element={<Forbidden />}
|
|
|
|
|
+ />
|
|
|
<Route
|
|
<Route
|
|
|
path='/console/models'
|
|
path='/console/models'
|
|
|
element={
|
|
element={
|
|
|
- <PrivateRoute>
|
|
|
|
|
|
|
+ <AdminRoute>
|
|
|
<ModelPage />
|
|
<ModelPage />
|
|
|
- </PrivateRoute>
|
|
|
|
|
|
|
+ </AdminRoute>
|
|
|
}
|
|
}
|
|
|
/>
|
|
/>
|
|
|
<Route
|
|
<Route
|
|
|
path='/console/channel'
|
|
path='/console/channel'
|
|
|
element={
|
|
element={
|
|
|
- <PrivateRoute>
|
|
|
|
|
|
|
+ <AdminRoute>
|
|
|
<Channel />
|
|
<Channel />
|
|
|
- </PrivateRoute>
|
|
|
|
|
|
|
+ </AdminRoute>
|
|
|
}
|
|
}
|
|
|
/>
|
|
/>
|
|
|
<Route
|
|
<Route
|
|
@@ -107,17 +112,17 @@ function App() {
|
|
|
<Route
|
|
<Route
|
|
|
path='/console/redemption'
|
|
path='/console/redemption'
|
|
|
element={
|
|
element={
|
|
|
- <PrivateRoute>
|
|
|
|
|
|
|
+ <AdminRoute>
|
|
|
<Redemption />
|
|
<Redemption />
|
|
|
- </PrivateRoute>
|
|
|
|
|
|
|
+ </AdminRoute>
|
|
|
}
|
|
}
|
|
|
/>
|
|
/>
|
|
|
<Route
|
|
<Route
|
|
|
path='/console/user'
|
|
path='/console/user'
|
|
|
element={
|
|
element={
|
|
|
- <PrivateRoute>
|
|
|
|
|
|
|
+ <AdminRoute>
|
|
|
<User />
|
|
<User />
|
|
|
- </PrivateRoute>
|
|
|
|
|
|
|
+ </AdminRoute>
|
|
|
}
|
|
}
|
|
|
/>
|
|
/>
|
|
|
<Route
|
|
<Route
|
|
@@ -183,11 +188,11 @@ function App() {
|
|
|
<Route
|
|
<Route
|
|
|
path='/console/setting'
|
|
path='/console/setting'
|
|
|
element={
|
|
element={
|
|
|
- <PrivateRoute>
|
|
|
|
|
|
|
+ <AdminRoute>
|
|
|
<Suspense fallback={<Loading></Loading>} key={location.pathname}>
|
|
<Suspense fallback={<Loading></Loading>} key={location.pathname}>
|
|
|
<Setting />
|
|
<Setting />
|
|
|
</Suspense>
|
|
</Suspense>
|
|
|
- </PrivateRoute>
|
|
|
|
|
|
|
+ </AdminRoute>
|
|
|
}
|
|
}
|
|
|
/>
|
|
/>
|
|
|
<Route
|
|
<Route
|