hl-core 0.0.10-beta.21 → 0.0.10-beta.22

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.
@@ -110,8 +110,16 @@ export const jwtDecode = (token?: string | null) => {
110
110
  };
111
111
 
112
112
  export const isValidToken = (token: string) => {
113
- const decoded = jwtDecode(token);
114
- return !!decoded && (new Date(Number(decoded.exp) * 1000).getTime() - Date.now()) / 1000 > 0;
113
+ try {
114
+ if (token) {
115
+ const decoded = jwtDecode(token);
116
+ return !!decoded && (new Date(Number(decoded.exp) * 1000).getTime() - Date.now()) / 1000 > 0;
117
+ }
118
+ return false;
119
+ } catch (err) {
120
+ console.log(err);
121
+ return false;
122
+ }
115
123
  };
116
124
 
117
125
  export const isValidGUID = (value: string) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hl-core",
3
- "version": "0.0.10-beta.21",
3
+ "version": "0.0.10-beta.22",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "nuxt.config.ts",