We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6f7dcef commit 976231bCopy full SHA for 976231b
1 file changed
hello-world/pwa/service-worker.js
@@ -59,11 +59,18 @@ self.addEventListener("fetch", (e) => {
59
60
// Otherwise, fetch from network
61
const response = await fetch(e.request);
62
- const cache = await caches.open(cacheName);
63
- console.log(`[Service Worker] Caching new resource: ${e.request.url}`);
64
- if (e.request.method !== "POST") {
+
+ if(
+ e.request.method !== "POST" &&
65
+ // Authorization requests should not be cached
66
+ !/https:\/\/.*?\.dynamsoft.com\/auth/.test(e.request.url)
67
+ // You can add other filter conditions
68
+ ){
69
+ const cache = await caches.open(cacheName);
70
+ console.log(`[Service Worker] Caching new resource: ${e.request.url}`);
71
cache.put(e.request, response.clone());
72
}
73
74
return response;
75
})()
76
);
0 commit comments