please
This commit is contained in:
parent
f3e621e600
commit
121ac0d104
1 changed files with 2 additions and 1 deletions
|
@ -6,13 +6,14 @@ self.addEventListener("fetch", event =>{
|
||||||
event.respondWith((async ()=>{
|
event.respondWith((async ()=>{
|
||||||
const resp = await fetch(event.request);
|
const resp = await fetch(event.request);
|
||||||
const resp2 = resp.clone();
|
const resp2 = resp.clone();
|
||||||
|
const resp3 = resp2.clone();
|
||||||
const body = await resp2.text();
|
const body = await resp2.text();
|
||||||
const url = new URL(event.request.url);
|
const url = new URL(event.request.url);
|
||||||
if(url.pathname.endsWith("light-dark-toggle")){
|
if(url.pathname.endsWith("light-dark-toggle")){
|
||||||
return await handle_redirect(event.request);
|
return await handle_redirect(event.request);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return await handle_html(event.request, resp2.clone(), body);
|
return await handle_html(event.request, resp3, body);
|
||||||
}
|
}
|
||||||
})());
|
})());
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue