File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ class GitHubApi{
2424 localStorage . setItem ( GitHubApi . #SESSION_KEY, JSON . stringify ( session ) ) ;
2525 }
2626 static async fetch ( path = '' , init = { } ) {
27- let accessToken = GitHubApi . getSession ( ) ?. accessToken ;
27+ const accessToken = GitHubApi . getSession ( ) ?. accessToken ;
2828 if ( accessToken ) {
2929 if ( init . headers === undefined ) {
3030 init . headers = { } ;
@@ -64,7 +64,9 @@ class GitHubApi{
6464 return response ;
6565 } else if ( response . status === 401 ) {
6666 GitHubApi . logout ( ) ;
67- throw new Error ( 'Unauthorized GitHub OAuth-Token. Logged out.' ) ;
67+ if ( accessToken ) {
68+ throw new Error ( 'Unauthorized GitHub OAuth-Token. Logged out.' ) ;
69+ }
6870 } else if ( [ 403 , 429 /*Unconfirmed*/ ] . includes ( response . status ) ) {
6971 let timestamp = 1000 * ( parseInt ( response . headers . get ( 'x-ratelimit-reset' ) ) + 1 ) ;
7072 if ( this . isLoggedIn ( ) ) {
You can’t perform that action at this time.
0 commit comments