diff --git a/public/search/serviceWorker.js b/public/search/serviceWorker.js index 14e5f07..a92c293 100644 --- a/public/search/serviceWorker.js +++ b/public/search/serviceWorker.js @@ -1,3 +1,4 @@ +// search dir Service worker let accessToken = ""; self.addEventListener("install", (event) => { diff --git a/src/main.jsx b/src/main.jsx index 654608f..292f1f1 100755 --- a/src/main.jsx +++ b/src/main.jsx @@ -27,15 +27,13 @@ const Main = () => { const base_url = import.meta.env.PROD ? "/search/serviceWorker.js" : "/serviceWorker.js"; - const scope_url = import.meta.env.PROD - ? "https://spectra-dev.adma.ai/search/" - : "http://localhost:5173/search/"; + const scope_url = import.meta.env.PROD ? "/search/" : "./search"; const registerServiceWorker = async () => { if ("serviceWorker" in navigator) { try { const registration = await navigator.serviceWorker.register(base_url, { - scope: "./search", + scope: scope_url, }); console.log("scope", registration.scope); console.log("controlled", navigator.serviceWorker.controller);