mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-08-09 15:35:19 +02:00
simplify return
This commit is contained in:
parent
002e49b42c
commit
ee7ebe4a6c
1 changed files with 1 additions and 1 deletions
|
@ -9,7 +9,7 @@ export function safe_jwt_decode(raw_jwt: string): JWT {
|
|||
try {
|
||||
const header = jwt_decode(raw_jwt, { header: true }) as Map<string, unknown>;
|
||||
const payload = jwt_decode(raw_jwt) as Map<string, unknown>;
|
||||
return { header: header, payload: payload };
|
||||
return { header, payload };
|
||||
} catch (e) {
|
||||
if (e instanceof InvalidTokenError) {
|
||||
return { header: new Map<string, unknown>(), payload: new Map<string, unknown>() };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue