Skip to content

Commit

Permalink
Base_url on production changed to /search
Browse files Browse the repository at this point in the history
  • Loading branch information
sergesoroka committed Oct 4, 2024
1 parent 1b8a9aa commit 0213809
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ const router = createBrowserRouter(
const stored_token = localStorage.getItem("token");
const token = keycloak.token ? keycloak.token : stored_token;

const base_url = import.meta.env.PROD ? "/search/worker.js" : "/worker.js";

if ("serviceWorker" in navigator) {
window.addEventListener("load", () => {
navigator.serviceWorker
.register("./worker.js")
.register(base_url)
.then((registration) => {
console.log(
"Service Worker registered with scope: ",
Expand Down
6 changes: 3 additions & 3 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
})
});

0 comments on commit 0213809

Please sign in to comment.