mirror of
https://github.com/Telecominfraproject/wlan-cloud-ui.git
synced 2025-11-01 11:17:59 +00:00
13 lines
275 B
JavaScript
13 lines
275 B
JavaScript
export function parseJwt(token) {
|
|
const base64Url = token.split('.')[0];
|
|
return JSON.parse(window.atob(base64Url));
|
|
}
|
|
|
|
export function isTokenExpired(token) {
|
|
const t = parseJwt(token);
|
|
if (t.exp && Date.now() < t.exp * 1000) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|