Skip to content

Commit a4323f9

Browse files
fix(socket): keep emit data payload
1 parent 6740640 commit a4323f9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/services/socket.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,12 @@ class Socket extends AbstractMicroservice {
222222
MiddlewareType.response,
223223
);
224224

225-
_.set(result ?? {}, 'payload', {
226-
...(result?.payload ?? {}),
227-
...(data?.payload ?? {}),
228-
});
225+
if (result?.payload || data?.payload) {
226+
_.set(result ?? {}, 'payload', {
227+
...(result?.payload ?? {}),
228+
...(data?.payload ?? {}),
229+
});
230+
}
229231

230232
const ioRoom = this.ioServer.to(room);
231233

0 commit comments

Comments
 (0)