fix: don't cache requests
This commit is contained in:
1 parent
bb6dbad3d8
commit
70a3a1610b
1 file changed
+2
-4
@@ -13,6 +13,7 @@ const ASSETS = [
|
||||
]
|
||||
|
||||
self.addEventListener('install', (event) => {
|
||||
console.info('[i] Installing service worker')
|
||||
// Create a new cache and add all files to it
|
||||
async function addFilesToCache() {
|
||||
const cache = await caches.open(CACHE)
|
||||
@@ -23,6 +24,7 @@ self.addEventListener('install', (event) => {
|
||||
})
|
||||
|
||||
self.addEventListener('activate', (event) => {
|
||||
console.info('[i] Activating service worker')
|
||||
// Remove previous cached data from disk
|
||||
async function deleteOldCaches() {
|
||||
for (const key of await caches.keys()) {
|
||||
@@ -61,10 +63,6 @@ self.addEventListener('fetch', (event) => {
|
||||
throw new Error('invalid response from fetch')
|
||||
}
|
||||
|
||||
if (response.status === 200) {
|
||||
cache.put(event.request, response.clone())
|
||||
}
|
||||
|
||||
return response
|
||||
} catch (err) {
|
||||
const response = await cache.match(event.request)
|
||||
|
||||
Reference in new issue
Block a user