diff --git a/libs/common/src/models/response/notification.response.ts b/libs/common/src/models/response/notification.response.ts index 894a00ee885..aa0ecc97b58 100644 --- a/libs/common/src/models/response/notification.response.ts +++ b/libs/common/src/models/response/notification.response.ts @@ -12,7 +12,16 @@ export class NotificationResponse extends BaseResponse { this.contextId = this.getResponseProperty("ContextId"); this.type = this.getResponseProperty("Type"); - const payload = this.getResponseProperty("Payload"); + let payload = this.getResponseProperty("Payload"); + + if (typeof payload === "string") { + try { + payload = JSON.parse(payload); + } catch { + // guess it was a string + } + } + switch (this.type) { case NotificationType.SyncCipherCreate: case NotificationType.SyncCipherDelete: diff --git a/libs/common/src/platform/notifications/internal/worker-webpush-connection.service.ts b/libs/common/src/platform/notifications/internal/worker-webpush-connection.service.ts index 631c624d667..74981b6782f 100644 --- a/libs/common/src/platform/notifications/internal/worker-webpush-connection.service.ts +++ b/libs/common/src/platform/notifications/internal/worker-webpush-connection.service.ts @@ -124,7 +124,9 @@ class MyWebPushConnector implements WebPushConnector { return this.webPushApiService.putSubscription(subscription.toJSON()); }).pipe( switchMap(() => this.pushEvent$), - map((e) => new NotificationResponse(e.data.json().data)), + map((e) => { + return new NotificationResponse(e.data.json().data); + }), ); }), );