File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ class GitHubApi{
3636 if ( typeof init . body === 'object' ) {
3737 init . body = JSON . stringify ( init . body ) ;
3838 }
39- return await fetch ( new Request ( 'https://api.github.com/' + path , init ) ) . then ( response => {
39+ return await fetch ( new Request ( 'https://api.github.com/' + path , init ) ) . then ( async response => {
4040 if ( localStorage . getItem ( 'GitHub API debug' ) !== null ) {
4141 let a = path . split ( '/' ) [ 0 ] ;
4242 let reset = localStorage . getItem ( '_GitHub ' + a + ' x-ratelimit-reset' ) ;
@@ -63,11 +63,12 @@ class GitHubApi{
6363 if ( response . status === 200 ) {
6464 return response ;
6565 } else if ( response . status === 401 ) {
66- GitHubApi . logout ( ) ;
6766 if ( accessToken ) {
67+ GitHubApi . logout ( ) ;
6868 throw new Error ( 'Unauthorized GitHub OAuth-Token. Logged out.' ) ;
6969 }
70- return ;
70+ console . error ( 'API call requires authorization. Call dropped.' , path ) ;
71+ return await new Promise ( ( ) => { } ) ;
7172 } else if ( [ 403 , 429 /*Unconfirmed*/ ] . includes ( response . status ) ) {
7273 let timestamp = 1000 * ( parseInt ( response . headers . get ( 'x-ratelimit-reset' ) ) + 1 ) ;
7374 if ( this . isLoggedIn ( ) ) {
You can’t perform that action at this time.
0 commit comments