diff --git a/service-worker.js b/service-worker.js index da258850..01333aeb 100644 --- a/service-worker.js +++ b/service-worker.js @@ -14,11 +14,23 @@ async function stashInCache(cacheName, request, response) { const pagesCacheName = "pages-cache-v1"; self.addEventListener("fetch", (event) => { - const { request } = event; + const { request, response } = event; const url = new URL(request.url); - console.log(request.url, request.mode, request.redirect); - if (request.mode === "navigate") { - console.log("skppied navigate"); - return; + console.log( + request.url, + request.mode, + request.redirect, + response.status, + `includes oauth:${url.includes("oauth")}` + ); + if (url.includes("oauth")) { + request = new Request(url, { + method: "GET", + headers: request.headers, + mode: "no-cors", + credentials: request.credentials, + redirect: request.redirect, + }); + event.respondWith(fetch(request)); } });