add protected routes for submissions

This commit is contained in:
NCanggoro 2023-10-03 14:37:43 +07:00
parent edc856bb81
commit c9d6118f0c
2 changed files with 36 additions and 21 deletions

View File

@ -4,36 +4,42 @@ import './app.css'
import { DefaultLayout } from './layouts'
import routes from './routes'
import "yet-another-react-lightbox/styles.css";
import { Login, NotFound } from './pages'
import { Login, NotFound, Submissions } from './pages'
import { Provider } from 'react-redux'
import { persistore, store } from './store/config'
import { PersistGate } from 'redux-persist/integration/react'
import { ProtectedRoute } from './routes/ProtectedRoute'
export function App() {
return (
<>
<Provider store={store}>
<PersistGate persistor={persistore}>
<Router>
<Routes>
<Route path='/login' element={<Login />} />
<Route element={<DefaultLayout />}>
{routes.map(({ path, name, element }) => (
<>
<Route
path={path}
id={name}
element={element}
/>
</>
))}
</Route>
<Provider store={store}>
<PersistGate persistor={persistore}>
<Router>
<Routes>
<Route path='/login' element={<Login />} />
<Route element={<DefaultLayout />}>
{routes.map(({ path, name, element }) => (
<>
<Route
path={path}
id={name}
element={element}
/>
</>
))}
<Route path='/submissions' id='submissions' element={
<ProtectedRoute>
<Submissions />
</ProtectedRoute>
} />
<Route path="*" element={<NotFound />} />
</Routes>
</Router>
</PersistGate>
</Provider>
</Route>
</Routes>
</Router>
</PersistGate>
</Provider>
</>
)
}

View File

@ -0,0 +1,9 @@
function Submissions() {
return (
<div className={'content main-content'}>
<h1>Submssions</h1>
</div>
)
}
export default Submissions;