Merge pull request #998 from Retrospring/only-pass-cache-requests-through-sw-fetch

Only pass cached requests through service worker
This commit is contained in:
Karina Kwiatek 2023-01-26 16:33:58 +01:00 committed by GitHub
commit 807a37767d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 {