Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 6994 | Rev 7000 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
6601 stevensc 1
import React, { lazy, Suspense, useEffect } from 'react'
2
import { useDispatch, useSelector } from 'react-redux'
6994 stevensc 3
import { BrowserRouter as Router, Switch } from 'react-router-dom'
6490 stevensc 4
import { getLanguage } from '../../redux/intl/intl.action'
6753 stevensc 5
import { getPermissions } from '../redux/auth/auth.actions'
6490 stevensc 6
 
6530 stevensc 7
import PublicRoute from './PublicRoute'
6601 stevensc 8
import PrivateRoute from './PrivateRoute'
6707 stevensc 9
import Spinner from '../components/UI/Spinner'
6512 stevensc 10
import NotificationAlert from '../components/UI/notification/NotificationAlert'
6738 stevensc 11
import LoaderContainer from '../components/UI/LoaderContainer'
6999 stevensc 12
import NotificationsPage from '../pages/notifications/NotificationsPage'
6490 stevensc 13
 
6707 stevensc 14
const Header = lazy(() => import('../components/navbar/Header'))
6601 stevensc 15
const Auth = lazy(() => import('../pages/auth/Auth'))
16
const DashboardPage = lazy(() => import('../pages/dashboard/DashboardPage'))
6707 stevensc 17
const MyConnectionsPage = lazy(() =>
6719 stevensc 18
  import('../pages/connections/MyConnectionsPage')
6707 stevensc 19
)
6724 stevensc 20
const InvitationsReceivedPage = lazy(() =>
21
  import('../pages/connections/InvitationsReceivedPage')
22
)
6719 stevensc 23
const InvitationsSendPage = lazy(() =>
6724 stevensc 24
  import('../pages/connections/InvitationsSendPage')
6719 stevensc 25
)
6725 stevensc 26
const PeopleYouMayKnowPage = lazy(() =>
27
  import('../pages/connections/PeopleYouMayKnowPage')
28
)
29
const PeopleBlockedPage = lazy(() =>
30
  import('../pages/connections/PeopleBlockedPage')
31
)
6738 stevensc 32
const MyProfilesPage = lazy(() => import('../pages/profiles/MyProfilesPage'))
33
const PeopleViewedMyProfilePage = lazy(() =>
34
  import('../pages/profiles/PeopleViewedMyProfilePage')
35
)
36
const SavedJobsPage = lazy(() => import('../pages/jobs/SavedJobsPage'))
37
const AppliedJobsPage = lazy(() => import('../pages/jobs/AppliedJobsPage'))
38
const GroupsRequestsSendPage = lazy(() =>
39
  import('../pages/groups/GroupsRequestsSendPage')
40
)
41
const GroupsRequestsReceivedPage = lazy(() =>
42
  import('../pages/groups/GroupsRequestsReceivedPage')
43
)
44
const JoinedGroupsPage = lazy(() => import('../pages/groups/JoinedGroupsPage'))
45
const MyGroupsPage = lazy(() => import('../pages/groups/MyGroupsPage'))
6753 stevensc 46
const MyCompanies = lazy(() => import('../pages/company/MyCompaniesPage'))
47
const FollowingCompaniesPage = lazy(() =>
48
  import('../pages/company/FollowingCompaniesPage')
49
)
50
const CompaniesWhenIWorkPage = lazy(() =>
51
  import('../pages/company/CompaniesWhenIWorkPage')
52
)
53
const CompanyRequestSendPage = lazy(() =>
54
  import('../pages/company/CompanyRequestSendPage')
55
)
56
const CompanyInvitationsReceivedPage = lazy(() =>
57
  import('../pages/company/CompanyInvitationsReceivedPage')
58
)
59
const ProfileViewPage = lazy(() => import('../pages/profiles/ProfileViewPage'))
6805 stevensc 60
const ProfileEditPage = lazy(() => import('../pages/profiles/ProfileEditPage'))
6862 stevensc 61
const CompanyViewPage = lazy(() => import('../pages/company/CompanyViewPage'))
62
const GroupViewPage = lazy(() => import('../pages/groups/GroupViewPage'))
6894 stevensc 63
const GroupEditPage = lazy(() => import('../pages/groups/GroupEditPage'))
6920 stevensc 64
const ChatPage = lazy(() => import('../pages/chat/ChatPage'))
6957 stevensc 65
const InmailPage = lazy(() => import('../pages/inmail/InmailPage'))
6993 stevensc 66
const MarketPlacePage = lazy(() =>
67
  import('../pages/marketplace/MarketplacePage')
68
)
6490 stevensc 69
 
70
const AppRouter = () => {
6753 stevensc 71
  const { isAuth, theme_id } = useSelector(({ auth }) => auth)
6490 stevensc 72
  const dispatch = useDispatch()
73
 
74
  useEffect(() => {
6745 stevensc 75
    dispatch(getPermissions())
6490 stevensc 76
    dispatch(getLanguage())
77
  }, [])
78
 
79
  return (
80
    <Router>
6753 stevensc 81
      <Suspense fallback={null}>
82
        {isAuth && <Header theme={theme_id} />}
83
      </Suspense>
6724 stevensc 84
 
6707 stevensc 85
      <Suspense
86
        fallback={
6738 stevensc 87
          <LoaderContainer>
6707 stevensc 88
            <Spinner />
6738 stevensc 89
          </LoaderContainer>
6707 stevensc 90
        }
91
      >
92
        <Switch>
6601 stevensc 93
          <PrivateRoute exact path="/dashboard" isAuthenticated={isAuth}>
94
            <DashboardPage />
95
          </PrivateRoute>
6738 stevensc 96
 
6994 stevensc 97
          <PrivateRoute
98
            exact
99
            path="/connection/my-connections"
100
            isAuthenticated={isAuth}
101
          >
102
            <MyConnectionsPage />
6707 stevensc 103
          </PrivateRoute>
6719 stevensc 104
          <PrivateRoute
105
            exact
6994 stevensc 106
            path="/connection/invitations-sent"
107
            isAuthenticated={isAuth}
108
          >
109
            <InvitationsSendPage />
110
          </PrivateRoute>
111
          <PrivateRoute
112
            exact
6724 stevensc 113
            path="/connection/invitations-received"
114
            isAuthenticated={isAuth}
115
          >
116
            <InvitationsReceivedPage />
117
          </PrivateRoute>
6725 stevensc 118
          <PrivateRoute
119
            exact
120
            path="/connection/people-you-may-know"
121
            isAuthenticated={isAuth}
122
          >
123
            <PeopleYouMayKnowPage />
124
          </PrivateRoute>
125
          <PrivateRoute
126
            exact
6726 stevensc 127
            path="/connection/people-blocked"
6725 stevensc 128
            isAuthenticated={isAuth}
129
          >
130
            <PeopleBlockedPage />
131
          </PrivateRoute>
6738 stevensc 132
 
6727 stevensc 133
          <PrivateRoute
134
            exact
135
            path="/profile/my-profiles"
136
            isAuthenticated={isAuth}
137
          >
138
            <MyProfilesPage />
139
          </PrivateRoute>
140
          <PrivateRoute
141
            exact
142
            path="/profile/people-viewed-profile"
143
            isAuthenticated={isAuth}
144
          >
145
            <PeopleViewedMyProfilePage />
146
          </PrivateRoute>
6862 stevensc 147
          <PrivateRoute path="/profile/view/:uuid" isAuthenticated={isAuth}>
148
            <ProfileViewPage />
149
          </PrivateRoute>
150
          <PrivateRoute
151
            path="/profile/my-profiles/edit/:uuid"
152
            isAuthenticated={isAuth}
153
          >
154
            <ProfileEditPage />
155
          </PrivateRoute>
6738 stevensc 156
 
6727 stevensc 157
          <PrivateRoute exact path="/job/saved-jobs" isAuthenticated={isAuth}>
158
            <SavedJobsPage />
159
          </PrivateRoute>
160
          <PrivateRoute exact path="/job/applied-jobs" isAuthenticated={isAuth}>
6729 stevensc 161
            <AppliedJobsPage />
6727 stevensc 162
          </PrivateRoute>
6601 stevensc 163
 
6738 stevensc 164
          <PrivateRoute
165
            exact
6740 stevensc 166
            path="/group/requests-sent"
6738 stevensc 167
            isAuthenticated={isAuth}
168
          >
169
            <GroupsRequestsSendPage />
170
          </PrivateRoute>
171
          <PrivateRoute
172
            exact
173
            path="/group/invitations-received"
174
            isAuthenticated={isAuth}
175
          >
176
            <GroupsRequestsReceivedPage />
177
          </PrivateRoute>
178
          <PrivateRoute
179
            exact
180
            path="/group/joined-groups"
181
            isAuthenticated={isAuth}
182
          >
183
            <JoinedGroupsPage />
184
          </PrivateRoute>
185
          <PrivateRoute exact path="/group/my-groups" isAuthenticated={isAuth}>
186
            <MyGroupsPage />
187
          </PrivateRoute>
6862 stevensc 188
          <PrivateRoute path="/group/view/:uuid" isAuthenticated={isAuth}>
189
            <GroupViewPage />
190
          </PrivateRoute>
6894 stevensc 191
          <PrivateRoute
6895 stevensc 192
            path="/group/my-groups/edit/:uuid"
6894 stevensc 193
            isAuthenticated={isAuth}
194
          >
195
            <GroupEditPage />
196
          </PrivateRoute>
6738 stevensc 197
 
6753 stevensc 198
          <PrivateRoute
199
            exact
200
            path="/company/my-companies"
201
            isAuthenticated={isAuth}
202
          >
203
            <MyCompanies />
204
          </PrivateRoute>
205
          <PrivateRoute
206
            exact
207
            path="/company/following-companies"
208
            isAuthenticated={isAuth}
209
          >
210
            <FollowingCompaniesPage />
211
          </PrivateRoute>
212
          <PrivateRoute
213
            exact
214
            path="/company/i-work-with"
215
            isAuthenticated={isAuth}
216
          >
217
            <CompaniesWhenIWorkPage />
218
          </PrivateRoute>
219
          <PrivateRoute
220
            exact
221
            path="/company/requests-sent"
222
            isAuthenticated={isAuth}
223
          >
224
            <CompanyRequestSendPage />
225
          </PrivateRoute>
226
          <PrivateRoute
227
            exact
228
            path="/company/requests-sent"
229
            isAuthenticated={isAuth}
230
          >
231
            <CompanyRequestSendPage />
232
          </PrivateRoute>
233
          <PrivateRoute
234
            exact
235
            path="/company/invitations-received"
236
            isAuthenticated={isAuth}
237
          >
238
            <CompanyInvitationsReceivedPage />
239
          </PrivateRoute>
6830 stevensc 240
          <PrivateRoute path="/company/view/:uuid" isAuthenticated={isAuth}>
241
            <CompanyViewPage />
242
          </PrivateRoute>
243
 
6911 stevensc 244
          <PrivateRoute path="/chat" isAuthenticated={isAuth}>
245
            <ChatPage />
246
          </PrivateRoute>
6983 stevensc 247
          <PrivateRoute path="/inmail/:uuid" isAuthenticated={isAuth}>
6970 stevensc 248
            <InmailPage />
249
          </PrivateRoute>
6983 stevensc 250
          <PrivateRoute path="/inmail" isAuthenticated={isAuth}>
6947 stevensc 251
            <InmailPage />
252
          </PrivateRoute>
6911 stevensc 253
 
6993 stevensc 254
          <PrivateRoute path="/marketplace" isAuthenticated={isAuth}>
255
            <MarketPlacePage />
256
          </PrivateRoute>
6999 stevensc 257
          <PrivateRoute path="/notifications" isAuthenticated={isAuth}>
258
            <NotificationsPage />
259
          </PrivateRoute>
6993 stevensc 260
 
6601 stevensc 261
          <PublicRoute path="/" isAuthenticated={isAuth}>
6546 stevensc 262
            <Auth />
263
          </PublicRoute>
6707 stevensc 264
        </Switch>
265
      </Suspense>
6512 stevensc 266
 
267
      <NotificationAlert />
6490 stevensc 268
    </Router>
269
  )
270
}
271
 
272
export default AppRouter