Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 6512 | Rev 6514 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 6512 Rev 6513
Línea 1... Línea 1...
1
import React, { useEffect, lazy } from 'react'
1
import React, { useEffect, lazy } from 'react'
2
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'
2
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'
3
import { useDispatch } from 'react-redux'
3
import { useDispatch, useSelector } from 'react-redux'
4
import { getLanguage } from '../../redux/intl/intl.action'
4
import { getLanguage } from '../../redux/intl/intl.action'
Línea 5... Línea 5...
5
 
5
 
6
import Auth from '../pages/auth/Auth'
6
import Auth from '../pages/auth/Auth'
7
import PrivateRoute from './PrivateRoute'
7
import PrivateRoute from './PrivateRoute'
Línea 10... Línea 10...
10
const HomeSection = lazy(() =>
10
const HomeSection = lazy(() =>
11
  import('../../dashboard/components/home-section/HomeSection')
11
  import('../../dashboard/components/home-section/HomeSection')
12
)
12
)
Línea 13... Línea 13...
13
 
13
 
-
 
14
const AppRouter = () => {
14
const AppRouter = () => {
15
  const { isAuth } = useSelector(({ auth }) => auth)
Línea 15... Línea 16...
15
  const dispatch = useDispatch()
16
  const dispatch = useDispatch()
16
 
17
 
17
  useEffect(() => {
18
  useEffect(() => {
Línea 22... Línea 23...
22
    <Router>
23
    <Router>
23
      <Switch>
24
      <Switch>
24
        <Route path="/">
25
        <Route path="/">
25
          <Auth />
26
          <Auth />
26
        </Route>
27
        </Route>
-
 
28
 
27
        <PrivateRoute exact path="/dashboard">
29
        <PrivateRoute exact path="/dashboard" isAuthenticated={isAuth}>
28
          <HomeSection />
30
          <HomeSection />
29
        </PrivateRoute>
31
        </PrivateRoute>
30
      </Switch>
32
      </Switch>
Línea 31... Línea 33...
31
 
33