Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 6512 | Rev 6514 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
6490 stevensc 1
import React, { useEffect, lazy } from 'react'
2
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'
6513 stevensc 3
import { useDispatch, useSelector } from 'react-redux'
6490 stevensc 4
import { getLanguage } from '../../redux/intl/intl.action'
5
 
6512 stevensc 6
import Auth from '../pages/auth/Auth'
6490 stevensc 7
import PrivateRoute from './PrivateRoute'
6512 stevensc 8
import NotificationAlert from '../components/UI/notification/NotificationAlert'
6490 stevensc 9
 
10
const HomeSection = lazy(() =>
11
  import('../../dashboard/components/home-section/HomeSection')
12
)
13
 
14
const AppRouter = () => {
6513 stevensc 15
  const { isAuth } = useSelector(({ auth }) => auth)
6490 stevensc 16
  const dispatch = useDispatch()
17
 
18
  useEffect(() => {
19
    dispatch(getLanguage())
20
  }, [])
21
 
22
  return (
23
    <Router>
24
      <Switch>
25
        <Route path="/">
26
          <Auth />
27
        </Route>
6513 stevensc 28
 
29
        <PrivateRoute exact path="/dashboard" isAuthenticated={isAuth}>
6490 stevensc 30
          <HomeSection />
31
        </PrivateRoute>
32
      </Switch>
6512 stevensc 33
 
34
      <NotificationAlert />
6490 stevensc 35
    </Router>
36
  )
37
}
38
 
39
export default AppRouter