@trudb/tru-common-lib 0.0.721 → 0.0.724

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.
@@ -6010,10 +6010,15 @@ class TruAuthJwtStrategy {
6010
6010
  user.create(userData);
6011
6011
  }
6012
6012
  getJwtToken() {
6013
- return JSON.parse(localStorage.getItem(this.JWT_ACCESS_TOKEN));
6013
+ try {
6014
+ return JSON.parse(localStorage.getItem(this.JWT_ACCESS_TOKEN));
6015
+ }
6016
+ catch (e) {
6017
+ return null;
6018
+ }
6014
6019
  }
6015
6020
  getDecodedJwtJsonData() {
6016
- let token = JSON.parse(localStorage.getItem(this.JWT_ACCESS_TOKEN));
6021
+ let token = this.getJwtToken();
6017
6022
  let payload = {};
6018
6023
  if (token && token !== "undefined") {
6019
6024
  const encodedPayload = token.split(".")[1];
@@ -6023,7 +6028,7 @@ class TruAuthJwtStrategy {
6023
6028
  return payload;
6024
6029
  }
6025
6030
  getToken() {
6026
- var token = JSON.parse(localStorage.getItem(this.JWT_ACCESS_TOKEN));
6031
+ var token = this.getJwtToken();
6027
6032
  if (token && token !== "undefined") {
6028
6033
  const encodedPayload = token.split(".")[1];
6029
6034
  const payloadStr = window.atob(encodedPayload);