Skip to content

Commit 0efc110

Browse files
bugfix
1 parent 572e447 commit 0efc110

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎Backend/controllers/notificationController.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const getAllNotifications = async (req, res) => {
3939

4040
const result = await Notification.findOne({ userId: userId })
4141
const notifications = { ...Notification, notification: result.notification.reverse() }
42-
return res.status(200).json({ status: "success", notifications: result ? result : {} });
42+
return res.status(200).json({ status: "success", notifications: result?.length ? result : [] });
4343
} catch (err) {
4444
return res.status(500).json({ status: "failed", message: "Internal server error: " + err });
4545
}

0 commit comments

Comments
 (0)