From 2f54bd38f33ddf47a9a235a25db1db59af554c82 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 2 Dec 2024 13:19:13 -0800 Subject: don't serve offline api requests --- src/service-worker.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/service-worker.js b/src/service-worker.js index 5db8abb3..63e69008 100644 --- a/src/service-worker.js +++ b/src/service-worker.js @@ -37,6 +37,11 @@ self.addEventListener("fetch", (event) => { const url = new URL(event.request.url); const cache = await caches.open(CACHE); + if (url.pathname.startsWith("/api")) { + // Allow the network to handle these requests + return; + } + // `build`/`files` can always be served from the cache if (ASSETS.includes(url.pathname)) { const response = await cache.match(url.pathname); -- cgit v1.2.3