Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 6519 Rev 6524
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, useSelector } from 'react-redux'
3
import { useDispatch } 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'))
-
 
12
 
11
const DashboardPage = lazy(() => import('../pages/dashboard/DashboardPage'))
Línea 13... Línea 12...
13
const AppRouter = () => {
12
 
14
  const { isAuth } = useSelector(({ auth }) => auth)
13
const AppRouter = () => {
15
  const dispatch = useDispatch()
14
  const dispatch = useDispatch()
Línea 16... Línea 15...
16
 
15
 
17
  useEffect(() => {
16
  useEffect(() => {
18
    dispatch(getLanguage())
17
    dispatch(getLanguage())
19
  }, [])
18
  }, [])
20
 
19
 
21
  return (
20
  return (
22
    <Router>
21
    <Router>
Línea 23... Línea 22...
23
      <Switch>
22
      <Switch>
24
        <Suspense fallback={null}>
23
        <Suspense fallback={null}>
25
          <PublicRoute path="/" isAuthenticated={isAuth}>
24
          <PublicRoute path="/">
26
            <Auth />
25
            <Auth />
27
          </PublicRoute>
26
          </PublicRoute>