@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.
@@ -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
- var currentPath = window.location.pathname;
649
- var isWhitelisted = publicUrlsList.includes(currentPath);
650
- if (user === null && !isWhitelisted) {
651
- window.location.replace('/auth/login');
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.