@@ -364,9 +364,12 @@ document.addEventListener('DOMContentLoaded', function () {
364
364
if ( ! org ) {
365
365
org = 'fossasia' ;
366
366
}
367
+ console . log ( '[Org Check] Checking organization:' , org ) ;
367
368
fetch ( `https://api.github.com/orgs/${ org } ` )
368
369
. then ( res => {
370
+ console . log ( '[Org Check] Response status for' , org , ':' , res . status ) ;
369
371
if ( res . status === 404 ) {
372
+ console . log ( '[Org Check] Organisation not found on GitHub:' , org ) ;
370
373
// Remove any existing toast with the same id
371
374
const oldToast = document . getElementById ( 'invalid-org-toast' ) ;
372
375
if ( oldToast ) oldToast . parentNode . removeChild ( oldToast ) ;
@@ -392,12 +395,17 @@ document.addEventListener('DOMContentLoaded', function () {
392
395
// Do NOT update storage or fetch data for invalid org
393
396
return ;
394
397
}
398
+ // Remove any existing toast with the same id (for valid orgs)
399
+ const oldToast = document . getElementById ( 'invalid-org-toast' ) ;
400
+ if ( oldToast ) oldToast . parentNode . removeChild ( oldToast ) ;
401
+ console . log ( '[Org Check] Organisation exists on GitHub:' , org ) ;
395
402
// Valid org: update storage and fetch data
396
403
chrome . storage . local . set ( { orgName : org } , function ( ) {
397
404
if ( window . generateScrumReport ) window . generateScrumReport ( ) ;
398
405
} ) ;
399
406
} )
400
- . catch ( ( ) => {
407
+ . catch ( ( err ) => {
408
+ console . log ( '[Org Check] Error validating organisation:' , org , err ) ;
401
409
// Remove any existing toast with the same id
402
410
const oldToast = document . getElementById ( 'invalid-org-toast' ) ;
403
411
if ( oldToast ) oldToast . parentNode . removeChild ( oldToast ) ;
0 commit comments