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:
commit
807a37767d
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue