I have the following code which works fine when the app is online . However when offline the code for the promise resolution or rejection doesn't get executed. I have googled the documentation for cloud firestore. I could find examples on querying the data offline but none on inserting data when the app is offline.Including only the relevant portions below.
db.collection('GroceryLists').doc().set(post).then(function () {
callback();
console.log('committed to the database');
return Promise.resolve('commited 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);
});