Only pass cached requests through service worker
This commit is contained in:
parent
93a0371476
commit
adaa4a4314
|
@ -47,6 +47,9 @@ self.addEventListener('install', function (event) {
|
||||||
});
|
});
|
||||||
|
|
||||||
self.addEventListener('fetch', 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(
|
event.respondWith(
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue