I am currently facing an issue with my code. It works perfectly fine when the application is online, but fails to execute the promise resolution or rejection when offline. I have searched through the cloud firestore documentation and found examples on querying data offline, but none on inserting data when the app is offline. I have included only the relevant code snippet below.
db.collection('GroceryLists').doc().set(post).then(function () {
callback();
console.log('committed to the database');
return Promise.resolve('committed to the database');
}).catch(function (error) {
//sometimes you get this error in the offline phase
console.log('error is ', error);
return Promise.reject('error is ' + error);
});