Skip to content

Commit

Permalink
Used response handling middleware for the response format.
Browse files Browse the repository at this point in the history
  • Loading branch information
Skorpios604 committed Feb 13, 2025
1 parent 012483d commit 8007daa
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Server/controllers/notificationController.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,29 @@ class NotificationController {
statusChanged: true,
prevStatus: true,
};

if (type === "webhook") {
await this.notificationService.sendWebhookNotification(
networkResponse,
config
);
}
res.json({ success: true, msg: "Notification sent successfully" });

return res.success({
msg: "Notification sent successfully"
});

} catch (error) {
logger.error({
message: error.message,
service: "NotificationController",
method: "triggerNotification",
stack: error.stack,
});
res.status(500).json({ success: false, msg: "Failed to send notification" });

return res.error({
msg: "Failed to send notification"
});
}
}
}
Expand Down

0 comments on commit 8007daa

Please sign in to comment.