Jelajahi Sumber

additonal conditional update

enzo 1 tahun lalu
induk
melakukan
2bc1a54b92
1 mengubah file dengan 9 tambahan dan 5 penghapusan
  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
         }