@veripass/react-sdk 1.0.19 → 1.0.21
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/dist/react-sdk.cjs.js +13 -5
- package/dist/react-sdk.cjs.js.map +1 -1
- package/dist/react-sdk.esm.js +13 -5
- package/dist/react-sdk.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/react-sdk.cjs.js
CHANGED
|
@@ -586,6 +586,10 @@ var AuthProvider = function AuthProvider(_ref) {
|
|
|
586
586
|
_useState2 = _slicedToArray(_useState, 2),
|
|
587
587
|
publicUrlsList = _useState2[0],
|
|
588
588
|
setPublicUrlsList = _useState2[1];
|
|
589
|
+
var _useState3 = React.useState(false),
|
|
590
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
591
|
+
isInitialized = _useState4[0],
|
|
592
|
+
setIsInitialized = _useState4[1];
|
|
589
593
|
|
|
590
594
|
// State to manage user data, persisted in local storage
|
|
591
595
|
var _useLocalStorage = useLocalStorage('veripass-user-data', null),
|
|
@@ -612,6 +616,7 @@ var AuthProvider = function AuthProvider(_ref) {
|
|
|
612
616
|
return extractPublicPaths(child);
|
|
613
617
|
});
|
|
614
618
|
setPublicUrlsList(publicPaths);
|
|
619
|
+
setIsInitialized(true);
|
|
615
620
|
}, [children]);
|
|
616
621
|
|
|
617
622
|
/**
|
|
@@ -665,12 +670,15 @@ var AuthProvider = function AuthProvider(_ref) {
|
|
|
665
670
|
|
|
666
671
|
// Effect to redirect if user is null
|
|
667
672
|
React.useEffect(function () {
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
673
|
+
if (isInitialized) {
|
|
674
|
+
var currentPath = window.location.pathname;
|
|
675
|
+
var isWhitelisted = publicUrlsList.includes(currentPath);
|
|
676
|
+
if (user === null && !isWhitelisted) {
|
|
677
|
+
debugger;
|
|
678
|
+
//window.location.replace('/auth/login');
|
|
679
|
+
}
|
|
672
680
|
}
|
|
673
|
-
}, [user, publicUrlsList]);
|
|
681
|
+
}, [user, publicUrlsList, isInitialized]);
|
|
674
682
|
|
|
675
683
|
/**
|
|
676
684
|
* Memoized value containing the user data and authentication functions.
|