@@ -125,35 +125,16 @@ export default function App() {
125
125
}
126
126
}
127
127
128
+
128
129
useEffect ( ( ) => {
129
130
// If not K8S_CLIENT then validateToken otherwise directly redirect
130
- async function validation ( ) {
131
- try {
132
- await validateToken ( )
133
- defaultRedirection ( )
134
- } catch ( err : any ) {
135
- // push to login without breaking search
136
- if ( err ?. code === 401 ) {
137
- const loginPath = URLS . LOGIN_SSO
138
- const newSearch = location . pathname . includes ( URLS . LOGIN_SSO )
139
- ? location . search
140
- : `?continue=${ location . pathname } `
141
- push ( `${ loginPath } ${ newSearch } ` )
142
- } else {
143
- setErrorPage ( true )
144
- showError ( err )
145
- }
146
- } finally {
147
- setValidating ( false )
148
- }
149
- }
150
131
if ( ! window . _env_ . K8S_CLIENT ) {
151
132
// Pass validation for direct email approval notification
152
- // if (location.pathname && location.pathname.includes('approve')) {
153
- // redirectToDirectApprovalNotification()
154
- // } else {
133
+ if ( location . pathname && location . pathname . includes ( 'approve' ) ) {
134
+ redirectToDirectApprovalNotification ( )
135
+ } else {
155
136
validation ( )
156
- // }
137
+ }
157
138
} else {
158
139
setValidating ( false )
159
140
defaultRedirection ( )
@@ -264,31 +245,27 @@ export default function App() {
264
245
) : (
265
246
< ErrorBoundary >
266
247
< BreadcrumbStore >
267
- < Switch >
268
- { /* {location.pathname && location.pathname.includes('approve') ? (
248
+ { location . pathname && location . pathname . includes ( 'approve' ) ? (
249
+ < Switch >
269
250
< Route
270
251
exact
271
- path={`/${approvalType?.toLocaleLowerCase()}/approve?token=${approvalToken} ` }
252
+ path = { `/${ approvalType ?. toLocaleLowerCase ( ) } /approve` }
272
253
render = { ( ) =>
273
254
GenericDirectApprovalModal && (
274
255
< GenericDirectApprovalModal approvalType = { approvalType } />
275
256
)
276
257
}
277
258
/>
278
- ) : ( */ }
279
- < >
280
- { ! window . _env_ . K8S_CLIENT && < Route path = { `/login` } component = { Login } /> }
281
- < Route path = "/" render = { ( ) => < NavigationRoutes /> } />
282
- < Redirect
283
- to = {
284
- window . _env_ . K8S_CLIENT
285
- ? '/'
286
- : `${ URLS . LOGIN_SSO } ${ location . search } `
287
- }
288
- />
289
- </ >
290
- { /* )} */ }
291
- </ Switch >
259
+ </ Switch >
260
+ ) : (
261
+ < Switch >
262
+ { ! window . _env_ . K8S_CLIENT && < Route path = { `/login` } component = { Login } /> }
263
+ < Route path = "/" render = { ( ) => < NavigationRoutes /> } />
264
+ < Redirect
265
+ to = { window . _env_ . K8S_CLIENT ? '/' : `${ URLS . LOGIN_SSO } ${ location . search } ` }
266
+ />
267
+ </ Switch >
268
+ ) }
292
269
< div id = "full-screen-modal" > </ div >
293
270
< div id = "visible-modal" > </ div >
294
271
< div id = "visible-modal-2" > </ div >
0 commit comments