mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-04 06:33:45 +00:00
Ensure notifications register button is only disabled when both all cameras and every individual camera is disabled
This commit is contained in:
parent
8c9e8a26c4
commit
a47da11b10
@ -165,23 +165,23 @@ export default function NotificationView({
|
||||
const [registration, setRegistration] =
|
||||
useState<ServiceWorkerRegistration | null>();
|
||||
|
||||
useEffect(() => {
|
||||
if (!("Notification" in window) || !window.isSecureContext) {
|
||||
return;
|
||||
}
|
||||
navigator.serviceWorker
|
||||
.getRegistration(NOTIFICATION_SERVICE_WORKER)
|
||||
.then((worker) => {
|
||||
if (worker) {
|
||||
setRegistration(worker);
|
||||
} else {
|
||||
setRegistration(null);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
setRegistration(null);
|
||||
});
|
||||
}, []);
|
||||
// useEffect(() => {
|
||||
// if (!("Notification" in window) || !window.isSecureContext) {
|
||||
// return;
|
||||
// }
|
||||
// navigator.serviceWorker
|
||||
// .getRegistration(NOTIFICATION_SERVICE_WORKER)
|
||||
// .then((worker) => {
|
||||
// if (worker) {
|
||||
// setRegistration(worker);
|
||||
// } else {
|
||||
// setRegistration(null);
|
||||
// }
|
||||
// })
|
||||
// .catch(() => {
|
||||
// setRegistration(null);
|
||||
// });
|
||||
// }, []);
|
||||
|
||||
// form
|
||||
|
||||
@ -520,7 +520,9 @@ export default function NotificationView({
|
||||
<Button
|
||||
aria-label={t("notification.registerDevice")}
|
||||
disabled={
|
||||
!config?.notifications.enabled || publicKey == undefined
|
||||
(!config?.notifications.enabled &&
|
||||
notificationCameras.length === 0) ||
|
||||
publicKey == undefined
|
||||
}
|
||||
onClick={() => {
|
||||
if (registration == null) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user