fix service-worker.js path with basePath

This commit is contained in:
vchikalkin 2024-04-23 18:52:40 +03:00
parent f9d2e95e5a
commit e5319af831

View File

@ -8,6 +8,7 @@ import initializeApollo from '@/apollo/client';
import { Loading, Notification } from '@/Components/Common'; import { Loading, Notification } from '@/Components/Common';
import Layout from '@/Components/Layout'; import Layout from '@/Components/Layout';
import { theme } from '@/config/ui'; import { theme } from '@/config/ui';
import { withBasePath } from '@/config/urls';
import { usePageLoading } from '@/hooks'; import { usePageLoading } from '@/hooks';
import StoreProvider from '@/stores/Provider'; import StoreProvider from '@/stores/Provider';
import getColors from '@/styles/colors'; import getColors from '@/styles/colors';
@ -37,7 +38,7 @@ function App({ Component, pageProps }) {
if ('serviceWorker' in navigator) { if ('serviceWorker' in navigator) {
window.addEventListener('load', () => { window.addEventListener('load', () => {
navigator.serviceWorker navigator.serviceWorker
.register('/service-worker.js') .register(withBasePath('/service-worker.js'))
.then((registration) => { .then((registration) => {
console.log('Service Worker registered:', registration); console.log('Service Worker registered:', registration);
}) })