disable register sw

This commit is contained in:
Rama Priyanto 2025-05-26 13:39:00 +07:00
parent 3d9975cbcb
commit 5c430a9733
1 changed files with 22 additions and 22 deletions

View File

@ -1,25 +1,25 @@
"use client"; // "use client";
import { useEffect } from "react"; // import { useEffect } from "react";
export function RegisterSW() { // export function RegisterSW() {
useEffect(() => { // useEffect(() => {
if ("serviceWorker" in navigator) { // if ("serviceWorker" in navigator) {
window.addEventListener("load", () => { // window.addEventListener("load", () => {
navigator.serviceWorker // navigator.serviceWorker
.register("/sw.js") // .register("/sw.js")
.then((registration) => { // .then((registration) => {
console.log("Service Worker registered: ", registration); // console.log("Service Worker registered: ", registration);
}) // })
.catch((registrationError) => { // .catch((registrationError) => {
console.log( // console.log(
"Service Worker registration failed: ", // "Service Worker registration failed: ",
registrationError // registrationError
); // );
}); // });
}); // });
} // }
}, []); // }, []);
return null; // return null;
} // }