mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-04 04:27:42 +03: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] =
|
const [registration, setRegistration] =
|
||||||
useState<ServiceWorkerRegistration | null>();
|
useState<ServiceWorkerRegistration | null>();
|
||||||
|
|
||||||
useEffect(() => {
|
// useEffect(() => {
|
||||||
if (!("Notification" in window) || !window.isSecureContext) {
|
// if (!("Notification" in window) || !window.isSecureContext) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
navigator.serviceWorker
|
// navigator.serviceWorker
|
||||||
.getRegistration(NOTIFICATION_SERVICE_WORKER)
|
// .getRegistration(NOTIFICATION_SERVICE_WORKER)
|
||||||
.then((worker) => {
|
// .then((worker) => {
|
||||||
if (worker) {
|
// if (worker) {
|
||||||
setRegistration(worker);
|
// setRegistration(worker);
|
||||||
} else {
|
// } else {
|
||||||
setRegistration(null);
|
// setRegistration(null);
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
.catch(() => {
|
// .catch(() => {
|
||||||
setRegistration(null);
|
// setRegistration(null);
|
||||||
});
|
// });
|
||||||
}, []);
|
// }, []);
|
||||||
|
|
||||||
// form
|
// form
|
||||||
|
|
||||||
@ -520,7 +520,9 @@ export default function NotificationView({
|
|||||||
<Button
|
<Button
|
||||||
aria-label={t("notification.registerDevice")}
|
aria-label={t("notification.registerDevice")}
|
||||||
disabled={
|
disabled={
|
||||||
!config?.notifications.enabled || publicKey == undefined
|
(!config?.notifications.enabled &&
|
||||||
|
notificationCameras.length === 0) ||
|
||||||
|
publicKey == undefined
|
||||||
}
|
}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (registration == null) {
|
if (registration == null) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user