Fix notifications API returning object instead of array
Local Build and Deploy / deploy (push) Successful in 2m12s

getNotifications() returns { notifications, total }, but the API route
wrapped that whole object as data.notifications. The client then called
.slice() on an object, throwing 's.slice is not a function' and crashing
every page via the global NotificationBell. Extract the array before
returning.
This commit is contained in:
openhands committed 2026-07-18 15:40:37 +02:00
1 parent 087a015f6e
commit 43305ef600
1 file changed
+1 -1
+1 -1
View File
@@ -11,7 +11,7 @@ export async function GET() {
}
const userId = Number(session.user.id);
const notifications = await notificationService.getNotifications(userId);
const { notifications } = await notificationService.getNotifications(userId);
const unreadCount = await notificationService.getUnreadCount(userId);
return NextResponse.json({ notifications, unreadCount });