Fix notifications API returning object instead of array
Local Build and Deploy / deploy (push) Successful in 2m12s
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:
1 parent
087a015f6e
commit
43305ef600
1 file changed
+1
-1
@@ -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 });
|
||||
|
||||
Reference in new issue
Block a user