mirror of
https://github.com/Telecominfraproject/wlan-cloud-ui.git
synced 2026-03-21 08:39:27 +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;
|
|
}
|