| Línea 1... |
Línea 1... |
| 1 |
import React, { lazy, Suspense, useEffect } from 'react'
|
1 |
import React, { lazy, Suspense, useEffect } from 'react'
|
| 2 |
import { useDispatch, useSelector } from 'react-redux'
|
2 |
import { useDispatch, useSelector } from 'react-redux'
|
| 3 |
import { Redirect, BrowserRouter as Router, Switch } from 'react-router-dom'
|
3 |
import { BrowserRouter as Router, Switch } from 'react-router-dom'
|
| 4 |
import { getLanguage } from '../../redux/intl/intl.action'
|
4 |
import { getLanguage } from '../../redux/intl/intl.action'
|
| 5 |
import { getPermissions } from '../redux/auth/auth.actions'
|
5 |
import { getPermissions } from '../redux/auth/auth.actions'
|
| Línea 6... |
Línea 6... |
| 6 |
|
6 |
|
| 7 |
import PublicRoute from './PublicRoute'
|
7 |
import PublicRoute from './PublicRoute'
|
| 8 |
import PrivateRoute from './PrivateRoute'
|
8 |
import PrivateRoute from './PrivateRoute'
|
| 9 |
import Spinner from '../components/UI/Spinner'
|
9 |
import Spinner from '../components/UI/Spinner'
|
| 10 |
import NotificationAlert from '../components/UI/notification/NotificationAlert'
|
10 |
import NotificationAlert from '../components/UI/notification/NotificationAlert'
|
| - |
|
11 |
import LoaderContainer from '../components/UI/LoaderContainer'
|
| Línea 11... |
Línea 12... |
| 11 |
import LoaderContainer from '../components/UI/LoaderContainer'
|
12 |
import ChatHelper from '../components/chat/helper/ChatHelper'
|
| 12 |
|
13 |
|
| 13 |
const Header = lazy(() => import('../components/navbar/Header'))
|
14 |
const Header = lazy(() => import('../components/navbar/Header'))
|
| 14 |
const Auth = lazy(() => import('../pages/auth/Auth'))
|
15 |
const Auth = lazy(() => import('../pages/auth/Auth'))
|
| Línea 78... |
Línea 79... |
| 78 |
const PostViewPage = lazy(() => import('../pages/posts/PostViewPage'))
|
79 |
const PostViewPage = lazy(() => import('../pages/posts/PostViewPage'))
|
| 79 |
const MyCoachPage = lazy(() => import('../pages/my-coach/MyCoachPage'))
|
80 |
const MyCoachPage = lazy(() => import('../pages/my-coach/MyCoachPage'))
|
| 80 |
const MyCoachViewPage = lazy(() => import('../pages/my-coach/MyCoachViewPage'))
|
81 |
const MyCoachViewPage = lazy(() => import('../pages/my-coach/MyCoachViewPage'))
|
| 81 |
const JobViewPage = lazy(() => import('../pages/jobs/JobView'))
|
82 |
const JobViewPage = lazy(() => import('../pages/jobs/JobView'))
|
| 82 |
const CalendarPage = lazy(() => import('../pages/calendar/CalendarPage'))
|
83 |
const CalendarPage = lazy(() => import('../pages/calendar/CalendarPage'))
|
| 83 |
const ChatHelper = lazy(() => import('../components/chat/helper/ChatHelper'))
|
- |
|
| Línea 84... |
Línea 84... |
| 84 |
|
84 |
|
| 85 |
const AppRouter = () => {
|
- |
|
| 86 |
const {
|
- |
|
| 87 |
is_logged_in: isAuth,
|
- |
|
| 88 |
theme_id,
|
- |
|
| 89 |
loading,
|
85 |
const AppRouter = () => {
|
| 90 |
} = useSelector(({ auth }) => auth)
|
86 |
const { is_logged_in: isAuth, theme_id } = useSelector(({ auth }) => auth)
|
| Línea 91... |
Línea 87... |
| 91 |
const dispatch = useDispatch()
|
87 |
const dispatch = useDispatch()
|
| 92 |
|
88 |
|
| 93 |
useEffect(() => {
|
89 |
useEffect(() => {
|
| 94 |
dispatch(getPermissions())
|
90 |
dispatch(getPermissions())
|
| Línea 95... |
Línea -... |
| 95 |
dispatch(getLanguage())
|
- |
|
| 96 |
}, [])
|
- |
|
| 97 |
|
- |
|
| 98 |
if (loading) {
|
- |
|
| 99 |
return (
|
- |
|
| 100 |
<LoaderContainer>
|
- |
|
| 101 |
<Spinner />
|
- |
|
| 102 |
</LoaderContainer>
|
- |
|
| 103 |
)
|
91 |
dispatch(getLanguage())
|
| 104 |
}
|
92 |
}, [])
|
| 105 |
|
93 |
|
| 106 |
return (
|
94 |
return (
|
| 107 |
<Router>
|
95 |
<Router>
|