Brijesh's Git Server — k3yst0n3 @ 9a5241c6a2a1c4480fa0bb43c3b4a5689d48c0f8

client/helpers/jwt.ts (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
function ParseJWT(token: string) {
  if (!token || !token.split(".")[1]) {
    return;
  }
  const base64Url = token.split(".")[1];
  const base64 = base64Url.replace("-", "+").replace("_", "/");
  return JSON.parse(window.atob(base64));
}

export default ParseJWT;