Skip to content

Commit

Permalink
scope on prod to /search/
Browse files Browse the repository at this point in the history
  • Loading branch information
sergesoroka committed Oct 8, 2024
1 parent f27c411 commit 372e461
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions public/search/serviceWorker.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// search dir Service worker
let accessToken = "";

self.addEventListener("install", (event) => {
Expand Down
6 changes: 2 additions & 4 deletions src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 372e461

Please sign in to comment.