Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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