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.
- package/composables/index.ts +10 -2
- package/package.json +1 -1
package/composables/index.ts
CHANGED
|
@@ -110,8 +110,16 @@ export const jwtDecode = (token?: string | null) => {
|
|
|
110
110
|
};
|
|
111
111
|
|
|
112
112
|
export const isValidToken = (token: string) => {
|
|
113
|
-
|
|
114
|
-
|
|
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) => {
|