Skip to content

Commit

Permalink
scope to ./search
Browse files Browse the repository at this point in the history
  • Loading branch information
sergesoroka committed Oct 8, 2024
1 parent f8699d9 commit b665c46
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion public/serviceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ self.addEventListener("fetch", (event) => {
event.respondWith(fetch(authRequest));
console.log("with token");
} else {
event.respondWith(fetch(request));
// event.respondWith(fetch(request));
console.log("without token");
}
});
5 changes: 4 additions & 1 deletion src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ const Main = () => {
const registerServiceWorker = async () => {
if ("serviceWorker" in navigator) {
try {
const registration = await navigator.serviceWorker.register(base_url);
const registration = await navigator.serviceWorker.register(base_url, {
scope: "./search",
});
console.log("scope", registration.scope);
console.log("controlled", navigator.serviceWorker.controller);

await registration.active.postMessage({
type: "TOKEN",
Expand Down

0 comments on commit b665c46

Please sign in to comment.