There was an error while loading. Please reload this page.
1 parent 572e447 commit 0efc110Copy full SHA for 0efc110
Backend/controllers/notificationController.js
@@ -39,7 +39,7 @@ export const getAllNotifications = async (req, res) => {
39
40
const result = await Notification.findOne({ userId: userId })
41
const notifications = { ...Notification, notification: result.notification.reverse() }
42
- return res.status(200).json({ status: "success", notifications: result ? result : {} });
+ return res.status(200).json({ status: "success", notifications: result?.length ? result : [] });
43
} catch (err) {
44
return res.status(500).json({ status: "failed", message: "Internal server error: " + err });
45
}
0 commit comments