mirror of
https://github.com/Brandon-Rozek/website-theme.git
synced 2024-11-22 08:16:29 -05:00
Don't save badges
This commit is contained in:
parent
be3e20feb6
commit
55a8368001
1 changed files with 52 additions and 51 deletions
|
@ -70,12 +70,14 @@ self.addEventListener('fetch', function (event) {
|
||||||
fetch(request).then(function (response) {
|
fetch(request).then(function (response) {
|
||||||
// If successful, create a copy of the response
|
// If successful, create a copy of the response
|
||||||
// and save it to the cache
|
// and save it to the cache
|
||||||
|
// Note: Ignore badges
|
||||||
|
if (request.url.includes("/badges")) {
|
||||||
let cacheCopy = response.clone();
|
let cacheCopy = response.clone();
|
||||||
event.waitUntil(caches.open(version + cacheName).then(function (cache) {
|
event.waitUntil(caches.open(version + cacheName).then(function (cache) {
|
||||||
return cache.put(request, cacheCopy);
|
return cache.put(request, cacheCopy);
|
||||||
}));
|
}));
|
||||||
|
}
|
||||||
return response;
|
return response;
|
||||||
|
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
// Otherwise, check the cache.
|
// Otherwise, check the cache.
|
||||||
return caches.match(request).then(function (response) {
|
return caches.match(request).then(function (response) {
|
||||||
|
@ -84,7 +86,6 @@ self.addEventListener('fetch', function (event) {
|
||||||
return response || caches.match(offlinePage);
|
return response || caches.match(offlinePage);
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue