Skip to content

Commit

Permalink
fix(sw.js): an object that was not a Response was passed to respondWi…
Browse files Browse the repository at this point in the history
…th()
  • Loading branch information
reuixiy committed May 25, 2021
1 parent cddaf25 commit 159652e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion assets/js/sw.js
Expand Up @@ -27,7 +27,10 @@ self.addEventListener('fetch', (event) => {
try {
const networkResponse = await fetch(event.request);

await cache.put(event.request, networkResponse.clone());
// Save/Update cache if network response is ok
if (networkResponse && networkResponse.status === 200) {
cache.put(event.request, networkResponse.clone());
}

return networkResponse;
} catch (e) {
Expand Down

0 comments on commit 159652e

Please sign in to comment.