Only pass cached requests through service worker

This commit is contained in:
Karina Kwiatek 2023-01-26 12:08:40 +01:00
parent 93a0371476
commit adaa4a4314
1 changed files with 3 additions and 0 deletions

View File

@ -47,6 +47,9 @@ self.addEventListener('install', function (event) {
});
self.addEventListener('fetch', function (event) {
const url = new URL(event.request.url);
if (event.request.method !== 'GET' || !OFFLINE_CACHE_PATHS.includes(url.pathname)) return;
event.respondWith(
(async () => {
try {