Used response handling middleware for the response format.
This commit is contained in:
1 parent
012483d14f
commit
8007daa66b
1 file changed
+10
-2
@@ -15,13 +15,18 @@ class NotificationController {
|
|||||||
statusChanged: true,
|
statusChanged: true,
|
||||||
prevStatus: true,
|
prevStatus: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (type === "webhook") {
|
if (type === "webhook") {
|
||||||
await this.notificationService.sendWebhookNotification(
|
await this.notificationService.sendWebhookNotification(
|
||||||
networkResponse,
|
networkResponse,
|
||||||
config
|
config
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
res.json({ success: true, msg: "Notification sent successfully" });
|
|
||||||
|
return res.success({
|
||||||
|
msg: "Notification sent successfully"
|
||||||
|
});
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error({
|
logger.error({
|
||||||
message: error.message,
|
message: error.message,
|
||||||
@@ -29,7 +34,10 @@ class NotificationController {
|
|||||||
method: "triggerNotification",
|
method: "triggerNotification",
|
||||||
stack: error.stack,
|
stack: error.stack,
|
||||||
});
|
});
|
||||||
res.status(500).json({ success: false, msg: "Failed to send notification" });
|
|
||||||
|
return res.error({
|
||||||
|
msg: "Failed to send notification"
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user