@dereekb/dbx-core 9.5.5 → 9.6.2
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/esm2020/lib/auth/router/provider/uirouter/hook.mjs +5 -5
- package/fesm2015/dereekb-dbx-core.mjs +4 -4
- package/fesm2015/dereekb-dbx-core.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-core.mjs +4 -4
- package/fesm2020/dereekb-dbx-core.mjs.map +1 -1
- package/lib/auth/router/provider/uirouter/hook.d.ts +5 -1
- package/package.json +4 -4
|
@@ -1691,7 +1691,7 @@ class DbxAuthService {
|
|
|
1691
1691
|
* This generates a TransitionHookFn that can be used with redirecting routes.
|
|
1692
1692
|
*/
|
|
1693
1693
|
function makeAuthTransitionHook(config) {
|
|
1694
|
-
const { defaultRedirectTarget, errorRedirectTarget = defaultRedirectTarget } = config;
|
|
1694
|
+
const { defaultRedirectTarget, errorRedirectTarget = defaultRedirectTarget, timeoutTime = 1000 } = config;
|
|
1695
1695
|
// https://ui-router.github.io/ng2/docs/latest/modules/transition.html#hookresult
|
|
1696
1696
|
const assertIsAuthenticated = (transition) => {
|
|
1697
1697
|
const injector = transition.injector();
|
|
@@ -1730,8 +1730,8 @@ function makeAuthTransitionHook(config) {
|
|
|
1730
1730
|
return redirectToObs;
|
|
1731
1731
|
}
|
|
1732
1732
|
const resultObs = decisionObs.pipe(
|
|
1733
|
-
// after
|
|
1734
|
-
timeoutStartWith(false,
|
|
1733
|
+
// after the timeoutTime seconds of no transition working, redirect with a false decision
|
|
1734
|
+
timeoutStartWith(false, timeoutTime), first(), switchMap((decision) => {
|
|
1735
1735
|
if (typeof decision === 'boolean') {
|
|
1736
1736
|
if (decision) {
|
|
1737
1737
|
return of(true);
|
|
@@ -1745,7 +1745,7 @@ function makeAuthTransitionHook(config) {
|
|
|
1745
1745
|
return of($state.target(asSegueRefString(segueRef.ref), segueRef.refParams, segueRef.refOptions));
|
|
1746
1746
|
}
|
|
1747
1747
|
}), catchError((x) => {
|
|
1748
|
-
console.warn(
|
|
1748
|
+
console.warn(`Encountered error in auth transition hook. Attempting redirect to ${errorRedirectTarget}.`, x);
|
|
1749
1749
|
return of($state.target(errorRedirectTarget, { location: true })); // Redirect to home
|
|
1750
1750
|
}));
|
|
1751
1751
|
return firstValueFrom(resultObs);
|