mirror of
https://github.com/zoldar/jenot.git
synced 2026-01-03 14:32:54 +00:00
Fix another SW caching mistake - sill can't into Promises proper
This commit is contained in:
parent
4880eeb66d
commit
31d53d8310
1 changed files with 2 additions and 1 deletions
|
|
@ -26,9 +26,10 @@ const cacheFirst = async (e) => {
|
||||||
|
|
||||||
const responseFromNetwork = await fetch(e.request);
|
const responseFromNetwork = await fetch(e.request);
|
||||||
// Cloning is needed because a response can only be consumed once.
|
// Cloning is needed because a response can only be consumed once.
|
||||||
|
const responseClone = responseFromNetwork.clone();
|
||||||
caches
|
caches
|
||||||
.open(cacheName)
|
.open(cacheName)
|
||||||
.then((cache) => cache.put(e.request, responseFromNetwork.clone()));
|
.then((cache) => cache.put(e.request.clone(), responseClone));
|
||||||
return responseFromNetwork;
|
return responseFromNetwork;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue