another fix
This commit is contained in:
parent
4b36f5372c
commit
dffb088204
1 changed files with 3 additions and 2 deletions
|
@ -5,13 +5,14 @@ self.addEventListener("fetch", event =>{
|
||||||
//TODO: make an endpoint to set the localStorage up then set the form to go to there and have it HTTP 302 or 307 with handle_html for html responses and handle_redirect for the other case
|
//TODO: make an endpoint to set the localStorage up then set the form to go to there and have it HTTP 302 or 307 with handle_html for html responses and handle_redirect for the other case
|
||||||
event.respondWith((async ()=>{
|
event.respondWith((async ()=>{
|
||||||
const resp = await fetch(event.request);
|
const resp = await fetch(event.request);
|
||||||
const body = await resp.text();
|
const resp2 = resp.clone();
|
||||||
|
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,resp, body);
|
return await handle_html(event.request, resp2, body);
|
||||||
}
|
}
|
||||||
})());
|
})());
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue