add protected routes for submissions
This commit is contained in:
parent
edc856bb81
commit
c9d6118f0c
48
src/app.tsx
48
src/app.tsx
@ -4,36 +4,42 @@ import './app.css'
|
|||||||
import { DefaultLayout } from './layouts'
|
import { DefaultLayout } from './layouts'
|
||||||
import routes from './routes'
|
import routes from './routes'
|
||||||
import "yet-another-react-lightbox/styles.css";
|
import "yet-another-react-lightbox/styles.css";
|
||||||
import { Login, NotFound } from './pages'
|
import { Login, NotFound, Submissions } from './pages'
|
||||||
import { Provider } from 'react-redux'
|
import { Provider } from 'react-redux'
|
||||||
import { persistore, store } from './store/config'
|
import { persistore, store } from './store/config'
|
||||||
import { PersistGate } from 'redux-persist/integration/react'
|
import { PersistGate } from 'redux-persist/integration/react'
|
||||||
|
import { ProtectedRoute } from './routes/ProtectedRoute'
|
||||||
|
|
||||||
|
|
||||||
export function App() {
|
export function App() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
<PersistGate persistor={persistore}>
|
<PersistGate persistor={persistore}>
|
||||||
<Router>
|
<Router>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path='/login' element={<Login />} />
|
<Route path='/login' element={<Login />} />
|
||||||
<Route element={<DefaultLayout />}>
|
<Route element={<DefaultLayout />}>
|
||||||
{routes.map(({ path, name, element }) => (
|
{routes.map(({ path, name, element }) => (
|
||||||
<>
|
<>
|
||||||
<Route
|
<Route
|
||||||
path={path}
|
path={path}
|
||||||
id={name}
|
id={name}
|
||||||
element={element}
|
element={element}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
))}
|
))}
|
||||||
</Route>
|
<Route path='/submissions' id='submissions' element={
|
||||||
|
<ProtectedRoute>
|
||||||
|
<Submissions />
|
||||||
|
</ProtectedRoute>
|
||||||
|
} />
|
||||||
<Route path="*" element={<NotFound />} />
|
<Route path="*" element={<NotFound />} />
|
||||||
</Routes>
|
</Route>
|
||||||
</Router>
|
</Routes>
|
||||||
</PersistGate>
|
</Router>
|
||||||
</Provider>
|
</PersistGate>
|
||||||
|
</Provider>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
9
src/pages/Submissions/index.tsx
Normal file
9
src/pages/Submissions/index.tsx
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
function Submissions() {
|
||||||
|
return (
|
||||||
|
<div className={'content main-content'}>
|
||||||
|
<h1>Submssions</h1>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Submissions;
|
Loading…
Reference in New Issue
Block a user