Parcourir la source

additonal conditional update

enzo il y a 1 an
Parent
commit
2bc1a54b92
1 fichiers modifiés avec 9 ajouts et 5 suppressions
  1. 9 5
      services/message-auditor.service.ts

+ 9 - 5
services/message-auditor.service.ts

@@ -189,11 +189,15 @@ export class MessageAuditorService implements MessageAuditorServiceInterface {
     // Notification message may have multiple nested data properties that maybe in string format
     private checkIfIsInPayloadDataFormat(payload: BaseMessage | any) {
         let parsedData: any
-        if (payload.data.data.data && typeof payload.data.data.data === 'string') {
-            parsedData = JSON.parse(payload.data.data.data)
-            // console.log(parsedData)
-            payload.data.data.data = parsedData
-            return payload
+        if(payload.data.data){
+            if (payload.data.data.data && typeof payload.data.data.data === 'string') {
+                parsedData = JSON.parse(payload.data.data.data)
+                // console.log(parsedData)
+                payload.data.data.data = parsedData
+                return payload
+            } else {
+                return payload
+            }
         } else {
             return payload
         }