0

i use an alarm for fetching github notifications using github v3 api, and noticing the fetch api are getting called timely, but are not getting the newest results, not sure what could be the problem?

 try{ 
    const count = await getNotifications(searchQueries);
    await chrome.storage.local.set({[dbName]: count})
    chrome.storage.local.get(dbName, showNotification);
 }catch(e) {
    console.log(e)
 }

 ...
 async function getNotifications(repo) {
   const headers = {
      'Authorization': `Bearer ${access_token}`,
      'Content-Type': 'application/json',
   }
   let response = await fetch(`https://api.github.com/notifications`, {headers});
   const notifications = await response.json();
   // alert(notifications.length)
   return notifications.length
 }
yc_l
  • 1
  • 2

0 Answers0