@frontegg/redux-store 6.6.1 → 6.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/auth/LoginState/saga.js +28 -0
- package/index.js +1 -1
- package/node/auth/LoginState/saga.js +28 -0
- package/node/index.js +1 -1
- package/package.json +1 -1
package/auth/LoginState/saga.js
CHANGED
|
@@ -369,6 +369,24 @@ function* requestAuthorizeSSR({
|
|
|
369
369
|
}));
|
|
370
370
|
}
|
|
371
371
|
|
|
372
|
+
const getUri = urlStrategy => {
|
|
373
|
+
if (urlStrategy === 'path') {
|
|
374
|
+
var _window3;
|
|
375
|
+
|
|
376
|
+
return ((_window3 = window) != null ? _window3 : document).location.pathname;
|
|
377
|
+
} else {
|
|
378
|
+
var _window4;
|
|
379
|
+
|
|
380
|
+
let uri = (((_window4 = window) != null ? _window4 : document).location.hash || '#').substring(1);
|
|
381
|
+
|
|
382
|
+
if (uri.indexOf('?') !== -1) {
|
|
383
|
+
return uri.substring(0, uri.indexOf('?'));
|
|
384
|
+
} else {
|
|
385
|
+
return uri;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
|
|
372
390
|
function* requestHostedLoginAuthorize({
|
|
373
391
|
payload: additionalParams
|
|
374
392
|
}) {
|
|
@@ -382,6 +400,16 @@ function* requestHostedLoginAuthorize({
|
|
|
382
400
|
onRedirectTo: state.auth.onRedirectTo,
|
|
383
401
|
context: state.root.context,
|
|
384
402
|
urlStrategy: state.root.urlStrategy
|
|
403
|
+
}));
|
|
404
|
+
const activeUri = getUri(urlStrategy);
|
|
405
|
+
|
|
406
|
+
if (activeUri === routes.hostedLoginRedirectUrl) {
|
|
407
|
+
console.debug('Calling loginWithRedirect while in hostedLoginCallback route');
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
yield put(actions.setState({
|
|
412
|
+
isLoading: true
|
|
385
413
|
})); // Generate the relevant params for the redirect
|
|
386
414
|
|
|
387
415
|
const nonce = createRandomString();
|
package/index.js
CHANGED
|
@@ -424,6 +424,24 @@ function* requestAuthorizeSSR({
|
|
|
424
424
|
}));
|
|
425
425
|
}
|
|
426
426
|
|
|
427
|
+
const getUri = urlStrategy => {
|
|
428
|
+
if (urlStrategy === 'path') {
|
|
429
|
+
var _window3;
|
|
430
|
+
|
|
431
|
+
return ((_window3 = window) != null ? _window3 : document).location.pathname;
|
|
432
|
+
} else {
|
|
433
|
+
var _window4;
|
|
434
|
+
|
|
435
|
+
let uri = (((_window4 = window) != null ? _window4 : document).location.hash || '#').substring(1);
|
|
436
|
+
|
|
437
|
+
if (uri.indexOf('?') !== -1) {
|
|
438
|
+
return uri.substring(0, uri.indexOf('?'));
|
|
439
|
+
} else {
|
|
440
|
+
return uri;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
|
|
427
445
|
function* requestHostedLoginAuthorize({
|
|
428
446
|
payload: additionalParams
|
|
429
447
|
}) {
|
|
@@ -437,6 +455,16 @@ function* requestHostedLoginAuthorize({
|
|
|
437
455
|
onRedirectTo: state.auth.onRedirectTo,
|
|
438
456
|
context: state.root.context,
|
|
439
457
|
urlStrategy: state.root.urlStrategy
|
|
458
|
+
}));
|
|
459
|
+
const activeUri = getUri(urlStrategy);
|
|
460
|
+
|
|
461
|
+
if (activeUri === routes.hostedLoginRedirectUrl) {
|
|
462
|
+
console.debug('Calling loginWithRedirect while in hostedLoginCallback route');
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
yield (0, _effects.put)(_reducer.actions.setState({
|
|
467
|
+
isLoading: true
|
|
440
468
|
})); // Generate the relevant params for the redirect
|
|
441
469
|
|
|
442
470
|
const nonce = (0, _helpers.createRandomString)();
|
package/node/index.js
CHANGED