* feat: add pwa support * fix: deepsource warning * fix: format warning * fix: lint error --------- Co-authored-by: sharpsalat <deniska.xrenov23@yandex.ru>
15 lines
378 B
TypeScript
15 lines
378 B
TypeScript
"use client";
|
|
|
|
import { useEffect } from "react";
|
|
|
|
export const ServiceWorkerRegistration = () => {
|
|
useEffect(() => {
|
|
if (!("serviceWorker" in navigator)) return;
|
|
navigator.serviceWorker.register("/sw.js", { scope: "/", updateViaCache: "none" }).catch((error) => {
|
|
console.error("Service worker registration failed", error);
|
|
});
|
|
}, []);
|
|
|
|
return null;
|
|
};
|