Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 6529 Rev 6530
Línea 1... Línea 1...
1
import React, { useEffect, lazy, Suspense } from 'react'
1
import React, { useEffect, lazy, Suspense } from 'react'
2
import { BrowserRouter as Router, Switch } from 'react-router-dom'
-
 
3
import { useDispatch, useSelector } from 'react-redux'
2
import { useDispatch, useSelector } from 'react-redux'
-
 
3
import { BrowserRouter as Router, Switch } from 'react-router-dom'
-
 
4
 
4
import { getLanguage } from '../../redux/intl/intl.action'
5
import { getLanguage } from '../../redux/intl/intl.action'
Línea 5... Línea 6...
5
 
6
 
-
 
7
import Auth from '../pages/auth/Auth'
6
import Auth from '../pages/auth/Auth'
8
import PublicRoute from './PublicRoute'
7
import PrivateRoute from './PrivateRoute'
9
import PrivateRoute from './PrivateRoute'
8
import NotificationAlert from '../components/UI/notification/NotificationAlert'
-
 
Línea 9... Línea 10...
9
import PublicRoute from './PublicRoute'
10
import NotificationAlert from '../components/UI/notification/NotificationAlert'
Línea 10... Línea 11...
10
 
11
 
11
const DashboardPage = lazy(() => import('../pages/dashboard/DashboardPage'))
12
const DashboardPage = lazy(() => import('../pages/dashboard/DashboardPage'))
Línea 16... Línea 17...
16
 
17
 
17
  useEffect(() => {
18
  useEffect(() => {
18
    dispatch(getLanguage())
19
    dispatch(getLanguage())
Línea 19... Línea -...
19
  }, [])
-
 
20
 
-
 
21
  useEffect(() => {
-
 
22
    console.log(isAuth)
-
 
23
  }, [isAuth])
20
  }, [])
24
 
21
 
25
  return (
22
  return (
26
    <Router>
23
    <Router>
27
      <Switch>
24
      <Switch>
28
        <Suspense fallback={null}>
25
        <Suspense fallback={null}>
29
          <PublicRoute path="/" isAuthenticated={isAuth}>
26
          <PublicRoute path="/" isAuthenticated={isAuth}>
Línea 30... Línea 27...
30
            <Auth />
27
            <Auth />
31
          </PublicRoute>
28
          </PublicRoute>
32
 
29
 
33
          <PrivateRoute exact path="/home" isAuthenticated={isAuth}>
30
          <PrivateRoute exact path="/home" isAuthenticated={isAuth}>
34
            <h1>Hello</h1>
31
            <DashboardPage />
Línea 35... Línea 32...
35
          </PrivateRoute>
32
          </PrivateRoute>