@osovitny/anatoly 3.19.6 → 3.19.7

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.
@@ -1911,10 +1911,15 @@ class AuthService extends ApiServiceBase {
1911
1911
  });
1912
1912
  }
1913
1913
  checkAndSetActiveAccount() {
1914
- let activeAccount = this.msalService.instance.getActiveAccount();
1915
- let accounts = this.msalService.instance.getAllAccounts();
1916
- if (!activeAccount && accounts.length > 0) {
1917
- this.msalService.instance.setActiveAccount(accounts[0]);
1914
+ try {
1915
+ let activeAccount = this.msalService.instance.getActiveAccount();
1916
+ let accounts = this.msalService.instance.getAllAccounts();
1917
+ if (!activeAccount && accounts.length > 0) {
1918
+ this.msalService.instance.setActiveAccount(accounts[0]);
1919
+ }
1920
+ }
1921
+ catch (error) {
1922
+ console.error("An error occurred: ", error);
1918
1923
  }
1919
1924
  }
1920
1925
  isPopup(popup) {
@@ -1940,8 +1945,13 @@ class AuthService extends ApiServiceBase {
1940
1945
  }
1941
1946
  // Public funcs
1942
1947
  getActiveAccount() {
1943
- this.checkAndSetActiveAccount();
1944
- return this.msalService.instance.getActiveAccount();
1948
+ try {
1949
+ this.checkAndSetActiveAccount();
1950
+ return this.msalService.instance.getActiveAccount();
1951
+ }
1952
+ catch (error) {
1953
+ console.error("An error occurred: ", error);
1954
+ }
1945
1955
  }
1946
1956
  getUserEmail() {
1947
1957
  let user = this.appContext.user;
@@ -2096,7 +2106,13 @@ class AuthService extends ApiServiceBase {
2096
2106
  }
2097
2107
  //MSAL check
2098
2108
  isUserAuthenticated() {
2099
- return this.msalService.instance.getActiveAccount() != null;
2109
+ try {
2110
+ return this.msalService.instance.getActiveAccount() != null;
2111
+ }
2112
+ catch (error) {
2113
+ console.error("An error occurred: ", error);
2114
+ }
2115
+ return false;
2100
2116
  }
2101
2117
  //MSAL + appContext check
2102
2118
  isUserSignedIn() {