Enhance callback handling in SocketUser class to ensure callback is a function before invocation, preventing potential runtime errors.
This commit is contained in:
parent
0748256ce8
commit
7002e5a6c1
@ -174,7 +174,9 @@ export class SocketUser {
|
||||
data.objectType,
|
||||
data.filter
|
||||
);
|
||||
callback({ success: true });
|
||||
if (typeof callback === 'function') {
|
||||
callback({ success: true });
|
||||
}
|
||||
}
|
||||
|
||||
async handleSubscribeToObjectUpdateEvent(data, callback) {
|
||||
@ -182,7 +184,9 @@ export class SocketUser {
|
||||
data._id,
|
||||
data.objectType
|
||||
);
|
||||
callback(result);
|
||||
if (typeof callback === 'function') {
|
||||
callback(result);
|
||||
}
|
||||
}
|
||||
|
||||
async handleSubscribeToObjectEventEvent(data) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user