mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-01-31 07:59:08 +01:00
Only pass cached requests through service worker
This commit is contained in:
parent
93a0371476
commit
adaa4a4314
1 changed files with 3 additions and 0 deletions
|
@ -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 a new issue