fix(webpush): notification must reflect the actual outcome

Signed-off-by: 0xsysr3ll <0xsysr3ll@pm.me>
This commit is contained in:
0xsysr3ll
2025-12-07 20:38:43 +01:00
parent be5bdc9975
commit 7ff0a8c040

View File

@@ -120,13 +120,23 @@ const UserWebPushSettings = () => {
if (endpointToDelete) {
await deletePushSubscriptionFromBackend(endpointToDelete);
} else if (dataDevices && dataDevices.length > 0) {
let hasFailures = false;
for (const device of dataDevices) {
try {
await deletePushSubscriptionFromBackend(device.endpoint);
} catch (error) {
// Continue deleting other subscriptions even if one fails
hasFailures = true;
}
}
if (hasFailures) {
addToast(intl.formatMessage(messages.disablingwebpusherror), {
autoDismiss: true,
appearance: 'error',
});
return;
}
}
localStorage.setItem('pushNotificationsEnabled', 'false');