This commit is contained in:
NoryiE
2025-02-16 14:12:49 +00:00
parent c6a89e5b35
commit e0aeb9b06e
2737 changed files with 5220 additions and 1039045 deletions

View File

@@ -1,28 +0,0 @@
'use strict';
var vueDemi = require('vue-demi');
var shared = require('@vueuse/shared');
var jwt_decode = require('jwt-decode');
function useJwt(encodedJwt, options = {}) {
const {
onError,
fallbackValue = null
} = options;
const decodeWithFallback = (encodedJwt2, options2) => {
try {
return jwt_decode(encodedJwt2, options2);
} catch (err) {
onError == null ? void 0 : onError(err);
return fallbackValue;
}
};
const header = vueDemi.computed(() => decodeWithFallback(shared.toValue(encodedJwt), { header: true }));
const payload = vueDemi.computed(() => decodeWithFallback(shared.toValue(encodedJwt)));
return {
header,
payload
};
}
exports.useJwt = useJwt;