PWA - Fetch GET URL when online
I am a bit confused about approaching deferred fetch requests.
I have a button in my app. when clicked, I want it to perform a fetch using the GET method. If the device is offline, I want that fetch deferred until the the device is online again. The fetch can complete successfully now or anytime in the future.
What approach should I be taking? Can you also clarify where the deferment should be take place? i.e. app script or service worker
You can learn more from articles like this one.
You can't keep your service worker alive indefinitely, which would be necessary to accomplish this in the service worker without that API. (You could try putting this logic into your web app code via a retry-with-backoff timer, if you want.)