I am updating my website to PWA, and I am using google workbox as service worker to cache data. I can cache JS, images css etc, but I can't cache back4app query data.
I tried to use workbox.backgroundSync
, but when I check in IndexDB
, it cache nothing. Here is my code:
const bgSyncPlugin = new workbox.backgroundSync.Plugin('myQueueName',
{
maxRetentionTime: 24 * 60 // Retry for max of 24 Hours
});
workbox.routing.registerRoute(
'https://parseapi.back4app.com/classes/*',
workbox.strategies.networkOnly({
plugins: [bgSyncPlugin]
}),
'POST'
);
1) Is it possible to cache back4app data using workbox
?
2) If possible, how do I do it? Can you give me an example of the code? I have tried for two days but didn't succeed. Thanks.