Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 6525 Rev 6526
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'
2
import { BrowserRouter as Router, 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'
8
import NotificationAlert from '../components/UI/notification/NotificationAlert'
8
import NotificationAlert from '../components/UI/notification/NotificationAlert'
Línea 9... Línea 9...
9
import PublicRoute from './PublicRoute'
9
import PublicRoute from './PublicRoute'
Línea 10... Línea 10...
10
 
10
 
-
 
11
const DashboardPage = lazy(() => import('../pages/dashboard/DashboardPage'))
11
const DashboardPage = lazy(() => import('../pages/dashboard/DashboardPage'))
12
 
Línea 12... Línea 13...
12
 
13
const AppRouter = () => {
13
const AppRouter = () => {
14
  const { isAuth } = useSelector(({ auth }) => auth)
14
  const dispatch = useDispatch()
15
  const dispatch = useDispatch()
Línea -... Línea 16...
-
 
16
 
-
 
17
  useEffect(() => {
-
 
18
    dispatch(getLanguage())
-
 
19
  }, [])
15
 
20
 
16
  useEffect(() => {
21
  useEffect(() => {
17
    dispatch(getLanguage())
22
    console.log(isAuth)
18
  }, [])
23
  }, [isAuth])
19
 
24
 
20
  return (
25
  return (
21
    <Router>
26
    <Router>
Línea 22... Línea 27...
22
      <Switch>
27
      <Switch>
23
        <Suspense fallback={null}>
28
        <Suspense fallback={null}>
24
          <PublicRoute path="/" isAuthenticated={false}>
29
          <PublicRoute path="/" isAuthenticated={isAuth}>
25
            <Auth />
30
            <Auth />
26
          </PublicRoute>
31
          </PublicRoute>
Línea 27... Línea 32...
27
 
32