Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 7374 Rev 7375
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 {
-
 
4
  Redirect,
-
 
5
  Route,
3
import { BrowserRouter as Router, Switch } from 'react-router-dom'
6
  BrowserRouter as Router,
-
 
7
  Switch,
-
 
8
} from 'react-router-dom'
4
import { getLanguage } from '../../redux/intl/intl.action'
9
import { getLanguage } from '../../redux/intl/intl.action'
5
import { getPermissions } from '../redux/auth/auth.actions'
10
import { getPermissions } from '../redux/auth/auth.actions'
Línea 6... Línea 11...
6
 
11
 
7
import PublicRoute from './PublicRoute'
12
import AuthRoute from './AuthRoute'
8
import PrivateRoute from './PrivateRoute'
13
import PrivateRoute from './PrivateRoute'
9
import Spinner from '../components/UI/Spinner'
14
import Spinner from '../components/UI/Spinner'
10
import NotificationAlert from '../components/UI/notification/NotificationAlert'
15
import NotificationAlert from '../components/UI/notification/NotificationAlert'
Línea 11... Línea 16...
11
import LoaderContainer from '../components/UI/LoaderContainer'
16
import LoaderContainer from '../components/UI/LoaderContainer'
12
 
-
 
13
const Header = lazy(() => import('../components/navbar/Header'))
17
 
14
const Auth = lazy(() => import('../pages/auth/Auth'))
18
const Header = lazy(() => import('../components/navbar/Header'))
15
const DashboardPage = lazy(() => import('../pages/dashboard/DashboardPage'))
19
const DashboardPage = lazy(() => import('../pages/dashboard/DashboardPage'))
16
const MyConnectionsPage = lazy(() =>
20
const MyConnectionsPage = lazy(() =>
17
  import('../pages/connections/MyConnectionsPage')
21
  import('../pages/connections/MyConnectionsPage')
Línea 79... Línea 83...
79
const MyCoachPage = lazy(() => import('../pages/my-coach/MyCoachPage'))
83
const MyCoachPage = lazy(() => import('../pages/my-coach/MyCoachPage'))
80
const MyCoachViewPage = lazy(() => import('../pages/my-coach/MyCoachViewPage'))
84
const MyCoachViewPage = lazy(() => import('../pages/my-coach/MyCoachViewPage'))
81
const JobViewPage = lazy(() => import('../pages/jobs/JobView'))
85
const JobViewPage = lazy(() => import('../pages/jobs/JobView'))
82
const CalendarPage = lazy(() => import('../pages/calendar/CalendarPage'))
86
const CalendarPage = lazy(() => import('../pages/calendar/CalendarPage'))
83
const ChatHelper = lazy(() => import('../components/chat/helper/ChatHelper'))
87
const ChatHelper = lazy(() => import('../components/chat/helper/ChatHelper'))
-
 
88
const SigninPage = lazy(() => import('../pages/auth/SigninPage'))
-
 
89
const SignupPage = lazy(() => import('../pages/auth/SignupPage'))
-
 
90
const ResetPasswordPage = lazy(() => import('../pages/auth/ResetPasswordPage'))
-
 
91
const ForgotPasswordPage = lazy(() =>
-
 
92
  import('../pages/auth/ForgotPasswordPage')
-
 
93
)
Línea 84... Línea 94...
84
 
94
 
85
const AppRouter = () => {
95
const AppRouter = () => {
86
  const { theme_id, isAuth, loading } = useSelector(({ auth }) => auth)
96
  const { theme_id, isAuth, loading } = useSelector(({ auth }) => auth)
Línea 114... Línea 124...
114
      >
124
      >
115
        <Switch>
125
        <Switch>
116
          <PrivateRoute exact path="/dashboard" isAuthenticated={isAuth}>
126
          <PrivateRoute exact path="/dashboard" isAuthenticated={isAuth}>
117
            <DashboardPage />
127
            <DashboardPage />
118
          </PrivateRoute>
128
          </PrivateRoute>
119
 
-
 
120
          <PrivateRoute
129
          <PrivateRoute
121
            exact
130
            exact
122
            path="/connection/my-connections"
131
            path="/connection/my-connections"
123
            isAuthenticated={isAuth}
132
            isAuthenticated={isAuth}
124
          >
133
          >
Línea 150... Línea 159...
150
            path="/connection/people-blocked"
159
            path="/connection/people-blocked"
151
            isAuthenticated={isAuth}
160
            isAuthenticated={isAuth}
152
          >
161
          >
153
            <PeopleBlockedPage />
162
            <PeopleBlockedPage />
154
          </PrivateRoute>
163
          </PrivateRoute>
155
 
-
 
156
          <PrivateRoute
164
          <PrivateRoute
157
            exact
165
            exact
158
            path="/profile/my-profiles"
166
            path="/profile/my-profiles"
159
            isAuthenticated={isAuth}
167
            isAuthenticated={isAuth}
160
          >
168
          >
Línea 174... Línea 182...
174
            path="/profile/my-profiles/edit/:uuid"
182
            path="/profile/my-profiles/edit/:uuid"
175
            isAuthenticated={isAuth}
183
            isAuthenticated={isAuth}
176
          >
184
          >
177
            <ProfileEditPage />
185
            <ProfileEditPage />
178
          </PrivateRoute>
186
          </PrivateRoute>
179
 
-
 
180
          <PrivateRoute exact path="/job/saved-jobs" isAuthenticated={isAuth}>
187
          <PrivateRoute exact path="/job/saved-jobs" isAuthenticated={isAuth}>
181
            <SavedJobsPage />
188
            <SavedJobsPage />
182
          </PrivateRoute>
189
          </PrivateRoute>
183
          <PrivateRoute exact path="/job/applied-jobs" isAuthenticated={isAuth}>
190
          <PrivateRoute exact path="/job/applied-jobs" isAuthenticated={isAuth}>
184
            <AppliedJobsPage />
191
            <AppliedJobsPage />
185
          </PrivateRoute>
192
          </PrivateRoute>
186
 
-
 
187
          <PrivateRoute
193
          <PrivateRoute
188
            exact
194
            exact
189
            path="/group/requests-sent"
195
            path="/group/requests-sent"
190
            isAuthenticated={isAuth}
196
            isAuthenticated={isAuth}
191
          >
197
          >
Línea 215... Línea 221...
215
            path="/group/my-groups/edit/:uuid"
221
            path="/group/my-groups/edit/:uuid"
216
            isAuthenticated={isAuth}
222
            isAuthenticated={isAuth}
217
          >
223
          >
218
            <GroupEditPage />
224
            <GroupEditPage />
219
          </PrivateRoute>
225
          </PrivateRoute>
220
 
-
 
221
          <PrivateRoute
226
          <PrivateRoute
222
            exact
227
            exact
223
            path="/company/my-companies"
228
            path="/company/my-companies"
224
            isAuthenticated={isAuth}
229
            isAuthenticated={isAuth}
225
          >
230
          >
Línea 261... Línea 266...
261
            <CompanyInvitationsReceivedPage />
266
            <CompanyInvitationsReceivedPage />
262
          </PrivateRoute>
267
          </PrivateRoute>
263
          <PrivateRoute path="/company/view/:uuid" isAuthenticated={isAuth}>
268
          <PrivateRoute path="/company/view/:uuid" isAuthenticated={isAuth}>
264
            <CompanyViewPage />
269
            <CompanyViewPage />
265
          </PrivateRoute>
270
          </PrivateRoute>
266
 
-
 
267
          <PrivateRoute path="/chat" isAuthenticated={isAuth}>
271
          <PrivateRoute path="/chat" isAuthenticated={isAuth}>
268
            <ChatPage />
272
            <ChatPage />
269
          </PrivateRoute>
273
          </PrivateRoute>
270
          <PrivateRoute path="/inmail/:uuid" isAuthenticated={isAuth}>
274
          <PrivateRoute path="/inmail/:uuid" isAuthenticated={isAuth}>
271
            <InmailPage />
275
            <InmailPage />
272
          </PrivateRoute>
276
          </PrivateRoute>
273
          <PrivateRoute path="/inmail" isAuthenticated={isAuth}>
277
          <PrivateRoute path="/inmail" isAuthenticated={isAuth}>
274
            <InmailPage />
278
            <InmailPage />
275
          </PrivateRoute>
279
          </PrivateRoute>
276
 
-
 
277
          <PrivateRoute path="/marketplace" isAuthenticated={isAuth}>
280
          <PrivateRoute path="/marketplace" isAuthenticated={isAuth}>
278
            <MarketPlacePage />
281
            <MarketPlacePage />
279
          </PrivateRoute>
282
          </PrivateRoute>
280
          <PrivateRoute path="/notifications" isAuthenticated={isAuth}>
283
          <PrivateRoute path="/notifications" isAuthenticated={isAuth}>
281
            <NotificationsPage />
284
            <NotificationsPage />
282
          </PrivateRoute>
285
          </PrivateRoute>
283
          <PrivateRoute path="/search" isAuthenticated={isAuth}>
286
          <PrivateRoute path="/search" isAuthenticated={isAuth}>
284
            <SearchPage />
287
            <SearchPage />
285
          </PrivateRoute>
288
          </PrivateRoute>
286
 
-
 
287
          <PrivateRoute
289
          <PrivateRoute
288
            path="/knowledge-area/view/:uuid"
290
            path="/knowledge-area/view/:uuid"
289
            isAuthenticated={isAuth}
291
            isAuthenticated={isAuth}
290
          >
292
          >
291
            <KnowledgeViewPage />
293
            <KnowledgeViewPage />
292
          </PrivateRoute>
294
          </PrivateRoute>
293
          <PrivateRoute path="/knowledge-area" isAuthenticated={isAuth}>
295
          <PrivateRoute path="/knowledge-area" isAuthenticated={isAuth}>
294
            <KnowledgeAreaPage />
296
            <KnowledgeAreaPage />
295
          </PrivateRoute>
297
          </PrivateRoute>
296
 
-
 
297
          <PrivateRoute path="/job/view/:uuid" isAuthenticated={isAuth}>
298
          <PrivateRoute path="/job/view/:uuid" isAuthenticated={isAuth}>
298
            <JobViewPage />
299
            <JobViewPage />
299
          </PrivateRoute>
300
          </PrivateRoute>
300
 
-
 
301
          <PrivateRoute path="/post/:uuid" isAuthenticated={isAuth}>
301
          <PrivateRoute path="/post/:uuid" isAuthenticated={isAuth}>
302
            <PostViewPage />
302
            <PostViewPage />
303
          </PrivateRoute>
303
          </PrivateRoute>
304
 
-
 
305
          <PrivateRoute path="/calendar" isAuthenticated={isAuth}>
304
          <PrivateRoute path="/calendar" isAuthenticated={isAuth}>
306
            <CalendarPage />
305
            <CalendarPage />
307
          </PrivateRoute>
306
          </PrivateRoute>
308
 
-
 
309
          <PrivateRoute
307
          <PrivateRoute
310
            path="/my-coach/questions/view/:uuid"
308
            path="/my-coach/questions/view/:uuid"
311
            isAuthenticated={isAuth}
309
            isAuthenticated={isAuth}
312
          >
310
          >
313
            <MyCoachViewPage />
311
            <MyCoachViewPage />
314
          </PrivateRoute>
312
          </PrivateRoute>
315
          <PrivateRoute exact path="/my-coach" isAuthenticated={isAuth}>
313
          <PrivateRoute exact path="/my-coach" isAuthenticated={isAuth}>
316
            <MyCoachPage />
314
            <MyCoachPage />
317
          </PrivateRoute>
315
          </PrivateRoute>
Línea -... Línea 316...
-
 
316
 
318
 
317
          {/* Authorization routes */}
-
 
318
          <AuthRoute exact path="/signin" isAuthenticated={isAuth}>
-
 
319
            <SigninPage />
-
 
320
          </AuthRoute>
-
 
321
          <AuthRoute exact path="/signup" isAuthenticated={isAuth}>
-
 
322
            <SignupPage />
-
 
323
          </AuthRoute>
-
 
324
          <AuthRoute exact path="/reset-password" isAuthenticated={isAuth}>
-
 
325
            <ResetPasswordPage />
-
 
326
          </AuthRoute>
-
 
327
          <AuthRoute exact path="/forgot-password" isAuthenticated={isAuth}>
319
          <PublicRoute path="/" isAuthenticated={isAuth}>
328
            <ForgotPasswordPage />
-
 
329
          </AuthRoute>
-
 
330
 
-
 
331
          <AuthRoute path="/" isAuthenticated={isAuth}>
320
            <Auth />
332
            <Redirect to="/signin" />
Línea 321... Línea 333...
321
          </PublicRoute>
333
          </AuthRoute>
322
 
334
 
323
          <PublicRoute path="*" isAuthenticated={isAuth}>
335
          <Route path="*">
324
            <h1>404 Not found</h1>
336
            <h1>404 Not found</h1>
325
          </PublicRoute>
337
          </Route>
Línea 326... Línea 338...
326
        </Switch>
338
        </Switch>