I tried updating IndexedDB data inside ".then" in fetch but that doesn't work inside event handlers as I got to know that from this post post-link. Updating the IndexedDB data outside the ".then" is working. So I created a boolean variable and tried updating it inside the ".then" and thought of updating the IndexedDB data outside but the boolean value is not getting updated inside the ".then".
.then(() =>{
data_inserted = true ;
})
Now outside the ".then"
console.log(data_inserted); // value is false
if ( data_inserted === true )
{
// update IndexedDB code
}
I saw this post post-link and I'm not sure how to do a callback function as they did for my code.
Kindly help me in updating the boolean variable.
Thanks in advance.