remove api from cache

main
Ugo Finnendahl 2 months ago
parent a1a37631b3
commit c98daf4b76
  1. 6
      sw.js

@ -14,8 +14,8 @@
// Names of the two caches used in this version of the service worker. // Names of the two caches used in this version of the service worker.
// Change to v2, etc. when you update any of the local resources, which will // Change to v2, etc. when you update any of the local resources, which will
// in turn trigger the install event again. // in turn trigger the install event again.
const PRECACHE = 'precache-v2'; const PRECACHE = 'precache-v3';
const RUNTIME = 'runtime-v2'; const RUNTIME = 'runtime-v3';
const cacheOn = true; const cacheOn = true;
// A list of local resources we always want to be cached. // A list of local resources we always want to be cached.
@ -51,7 +51,7 @@ self.addEventListener('activate', event => {
// from the network before returning it to the page. // from the network before returning it to the page.
self.addEventListener('fetch', event => { self.addEventListener('fetch', event => {
// Skip cross-origin requests, like those for Google Analytics. // Skip cross-origin requests, like those for Google Analytics.
if (event.request.url.startsWith(self.location.origin) && !event.request.url.includes("panel") && event.request.method === "GET" && cacheOn) { if (event.request.url.startsWith(self.location.origin) && !event.request.url.includes("panel") && !event.request.url.includes("api") && event.request.method === "GET" && cacheOn) {
event.respondWith( event.respondWith(
caches.match(event.request).then(cachedResponse => { caches.match(event.request).then(cachedResponse => {
if (cachedResponse) { if (cachedResponse) {

Loading…
Cancel
Save