Skip to content

Commit 926600e

Browse files
authored
Don't throw error when logged out (#83)
1 parent e9abf86 commit 926600e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ collect.set('isNewRepoTemplate', [
574574
]);
575575

576576
/** Get the logged-in user’s username */
577-
const getUsername = () => document.querySelector('meta[name="user-login"]')!.getAttribute('content')!;
577+
const getUsername = (): string | undefined => document.querySelector('meta[name="user-login"]')?.getAttribute('content')!;
578578

579579
/** Drop leading and trailing slashes */
580580
const getCleanPathname = (url: URL | HTMLAnchorElement | Location = location): string => url.pathname.slice(1, url.pathname.endsWith('/') ? -1 : undefined);

0 commit comments

Comments
 (0)