Skip to content

Commit

Permalink
dont touch non-static fetches
Browse files Browse the repository at this point in the history
  • Loading branch information
ajgeiss0702 committed Dec 14, 2023
1 parent 3393892 commit 7450eca
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/service-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ self.addEventListener('fetch', (event) => {
// ignore POST requests etc
if (event.request.method !== 'GET') return;

const url = new URL(event.request.url);

async function respond() {
const url = new URL(event.request.url);
const cache = await caches.open(CACHE);

// `build`/`files` can always be served from the cache
Expand Down Expand Up @@ -76,5 +77,5 @@ self.addEventListener('fetch', (event) => {
}
}

event.respondWith(respond());
if(ASSETS.includes(url.pathname)) event.respondWith(respond());
});

0 comments on commit 7450eca

Please sign in to comment.