From ea2dbb2f339a5e821f1431861f9857cc123b5933 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 15 May 2021 23:25:06 +0200 Subject: [PATCH] web/admin: fix error when copying token while none exist Signed-off-by: Jens Langhammer --- web/src/elements/buttons/TokenCopyButton.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/src/elements/buttons/TokenCopyButton.ts b/web/src/elements/buttons/TokenCopyButton.ts index a8dedf347..b04c327d8 100644 --- a/web/src/elements/buttons/TokenCopyButton.ts +++ b/web/src/elements/buttons/TokenCopyButton.ts @@ -29,8 +29,8 @@ export class TokenCopyButton extends ActionButton { this.buttonClass = PRIMARY_CLASS; }, 1500); }); - }).catch((err: Response) => { - return err.json().then(errResp => { + }).catch((err: Response | undefined) => { + return err?.json().then(errResp => { throw new Error(errResp["detail"]); }); });