Test for url to see if cache is needed

This commit is contained in:
ernstmul committed 2024-11-01 11:30:48 +01:00
1 parent 3d1cc2ee91
commit 37be18f408
1 file changed
+5 -1
+5 -1
View File
@@ -22,7 +22,11 @@ sw.addEventListener('install', (event) => {
await cache.addAll(ASSETS);
}
event.waitUntil(addFilesToCache());
// Check if the page URL does not match the exclusion path
const shouldCache = !/\/console\/auth\/oauth2\/.*/.test(location.pathname);
if (shouldCache) {
event.waitUntil(addFilesToCache());
}
});
sw.addEventListener('activate', (event) => {