Fix of the notification subscription
This commit is contained in:
@@ -162,19 +162,17 @@ class PushNotificationManager {
|
||||
const subscription = await this.serviceWorkerRegistration.pushManager.getSubscription();
|
||||
if (!subscription) {
|
||||
console.warn('No active push subscription');
|
||||
return false;
|
||||
return true; // Bereits deaktiviert
|
||||
}
|
||||
|
||||
// Remove subscription on server
|
||||
const success = await this.removeSubscriptionFromServer(subscription);
|
||||
// Best-Effort: Dem Server Bescheid geben (wir ignorieren absichtlich,
|
||||
// falls der Server das Abo nicht mehr kennt)
|
||||
await this.removeSubscriptionFromServer(subscription);
|
||||
|
||||
// Unsubscribe from push service
|
||||
if (success) {
|
||||
await subscription.unsubscribe();
|
||||
return true;
|
||||
}
|
||||
// WICHTIG: Das Abo im Browser immer zwingend löschen!
|
||||
await subscription.unsubscribe();
|
||||
return true;
|
||||
|
||||
return false;
|
||||
} catch (error) {
|
||||
console.error('Failed to unsubscribe from push notifications:', error);
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user