|
|
@ -62,12 +62,22 @@ export const grabTokenData = (token: string): TokenData|null => { |
|
|
|
if (!isClient()) { |
|
|
|
if (!isClient()) { |
|
|
|
return null |
|
|
|
return null |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const parts = token.split('.') |
|
|
|
const parts = token.split('.') |
|
|
|
let payload = 3 === parts.length && parts[1] ? JSON.parse(window.atob(parts[1])) : null |
|
|
|
if (parts.length !== 3) { |
|
|
|
let headers = 3 === parts.length && parts[0] ? JSON.parse(window.atob(parts[0])) : null |
|
|
|
return null |
|
|
|
if (!payload || !headers){ |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let payload = JSON.parse(window.atob(parts[1])) |
|
|
|
|
|
|
|
if (!payload){ |
|
|
|
return null |
|
|
|
return null |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let headers = JSON.parse(window.atob(parts[0])) |
|
|
|
|
|
|
|
if (!headers){ |
|
|
|
|
|
|
|
return null |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
payload, |
|
|
|
payload, |
|
|
|
headers, |
|
|
|
headers, |
|
|
|