diff --git a/frontend/components/notifications/management/NotificationsManagementPairedDeviceModalContent.vue b/frontend/components/notifications/management/NotificationsManagementPairedDeviceModalContent.vue index 739c5ecaf..705df6cdb 100644 --- a/frontend/components/notifications/management/NotificationsManagementPairedDeviceModalContent.vue +++ b/frontend/components/notifications/management/NotificationsManagementPairedDeviceModalContent.vue @@ -13,9 +13,11 @@ const emit = defineEmits<{ (e: 'remove-device', id: number): void, (e: 'toggle-notifications', { id, + name, value, }: { id: number, + name?: string, value: boolean, }): void, }>() @@ -41,7 +43,7 @@ const hasNotifications = ref(props.device.is_notifications_enabled)
{{ $t("notifications.general.paired_devices.mobile_notifications") }}
diff --git a/frontend/components/notifications/management/NotificationsManagementPairedDevicesModal.vue b/frontend/components/notifications/management/NotificationsManagementPairedDevicesModal.vue index b0fa06707..6ed196515 100644 --- a/frontend/components/notifications/management/NotificationsManagementPairedDevicesModal.vue +++ b/frontend/components/notifications/management/NotificationsManagementPairedDevicesModal.vue @@ -9,13 +9,16 @@ const close = () => { const handleToggleNotifications = ({ id, + name, value, }: { id: number, + name?: string, value: boolean, }) => { notificationsManagementStore.setNotificationForPairedDevice({ id, + name, value, }) const device = notificationsManagementStore.settings.paired_devices.find(device => device.id === id) diff --git a/frontend/stores/notifications/useNotificationsManagementStore.ts b/frontend/stores/notifications/useNotificationsManagementStore.ts index b7bfab6d2..fdc71aeea 100644 --- a/frontend/stores/notifications/useNotificationsManagementStore.ts +++ b/frontend/stores/notifications/useNotificationsManagementStore.ts @@ -55,14 +55,16 @@ export const useNotificationsManagementStore = defineStore('notifications-manage ).then(() => { // using optimistic ui here to avoid calling the api after delete settings.value.paired_devices - = [ ...settings.value.paired_devices.filter(device => device.id !== id) ] + = [ ...settings.value.paired_devices.filter(device => device.id !== id) ] }).then(() => refreshOverview()) } const setNotificationForPairedDevice = async ({ id, + name, value, }: { id: number, + name?: string, value: boolean, }) => { await fetch( @@ -70,7 +72,7 @@ export const useNotificationsManagementStore = defineStore('notifications-manage { body: { is_notifications_enabled: value, - name: id, + name, }, }, {