@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.esm.js
CHANGED
|
@@ -566,6 +566,10 @@ var AuthProvider = function AuthProvider(_ref) {
|
|
|
566
566
|
_useState2 = _slicedToArray(_useState, 2),
|
|
567
567
|
publicUrlsList = _useState2[0],
|
|
568
568
|
setPublicUrlsList = _useState2[1];
|
|
569
|
+
var _useState3 = useState(false),
|
|
570
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
571
|
+
isInitialized = _useState4[0],
|
|
572
|
+
setIsInitialized = _useState4[1];
|
|
569
573
|
|
|
570
574
|
// State to manage user data, persisted in local storage
|
|
571
575
|
var _useLocalStorage = useLocalStorage('veripass-user-data', null),
|
|
@@ -592,6 +596,7 @@ var AuthProvider = function AuthProvider(_ref) {
|
|
|
592
596
|
return extractPublicPaths(child);
|
|
593
597
|
});
|
|
594
598
|
setPublicUrlsList(publicPaths);
|
|
599
|
+
setIsInitialized(true);
|
|
595
600
|
}, [children]);
|
|
596
601
|
|
|
597
602
|
/**
|
|
@@ -645,12 +650,15 @@ var AuthProvider = function AuthProvider(_ref) {
|
|
|
645
650
|
|
|
646
651
|
// Effect to redirect if user is null
|
|
647
652
|
useEffect(function () {
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
653
|
+
if (isInitialized) {
|
|
654
|
+
var currentPath = window.location.pathname;
|
|
655
|
+
var isWhitelisted = publicUrlsList.includes(currentPath);
|
|
656
|
+
if (user === null && !isWhitelisted) {
|
|
657
|
+
debugger;
|
|
658
|
+
//window.location.replace('/auth/login');
|
|
659
|
+
}
|
|
652
660
|
}
|
|
653
|
-
}, [user, publicUrlsList]);
|
|
661
|
+
}, [user, publicUrlsList, isInitialized]);
|
|
654
662
|
|
|
655
663
|
/**
|
|
656
664
|
* Memoized value containing the user data and authentication functions.
|