Skip to content

Commit d4f5c74

Browse files
committed
toast properly added
1 parent cef2f05 commit d4f5c74

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/scripts/popup.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,12 @@ document.addEventListener('DOMContentLoaded', function () {
364364
if (!org) {
365365
org = 'fossasia';
366366
}
367+
console.log('[Org Check] Checking organization:', org);
367368
fetch(`https://api.github.com/orgs/${org}`)
368369
.then(res => {
370+
console.log('[Org Check] Response status for', org, ':', res.status);
369371
if (res.status === 404) {
372+
console.log('[Org Check] Organisation not found on GitHub:', org);
370373
// Remove any existing toast with the same id
371374
const oldToast = document.getElementById('invalid-org-toast');
372375
if (oldToast) oldToast.parentNode.removeChild(oldToast);
@@ -392,12 +395,17 @@ document.addEventListener('DOMContentLoaded', function () {
392395
// Do NOT update storage or fetch data for invalid org
393396
return;
394397
}
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);
395402
// Valid org: update storage and fetch data
396403
chrome.storage.local.set({ orgName: org }, function () {
397404
if (window.generateScrumReport) window.generateScrumReport();
398405
});
399406
})
400-
.catch(() => {
407+
.catch((err) => {
408+
console.log('[Org Check] Error validating organisation:', org, err);
401409
// Remove any existing toast with the same id
402410
const oldToast = document.getElementById('invalid-org-toast');
403411
if (oldToast) oldToast.parentNode.removeChild(oldToast);

0 commit comments

Comments
 (0)