From 0e9ea23d9859b1d8a9cb65ffe5099a6a9e992a72 Mon Sep 17 00:00:00 2001 From: Nils Pukropp Date: Tue, 17 Feb 2026 18:25:35 +0100 Subject: [PATCH] fixed ts error --- backend/api/views.py | 1 + frontend/src/App.tsx | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/api/views.py b/backend/api/views.py index 6bc2507..9b83e09 100644 --- a/backend/api/views.py +++ b/backend/api/views.py @@ -197,6 +197,7 @@ class ReplyViewSet(viewsets.ModelViewSet): class NotificationViewSet(viewsets.ReadOnlyModelViewSet): serializer_class = NotificationSerializer permission_classes = [permissions.IsAuthenticated] + pagination_class = None def get_queryset(self): return self.request.user.notifications.select_related('actor', 'rating__flavor', 'reply__rating__flavor').order_by('-created_at') diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index d9de4c0..7922a37 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -197,7 +197,8 @@ const App: React.FC = () => { const fetchNotifications = async () => { try { const res = await api.get('notifications/'); - setNotifications(res.data); + const data = Array.isArray(res.data) ? res.data : (res.data.results || []); + setNotifications(data); } catch (err) { console.error('Failed to fetch notifications'); } @@ -220,7 +221,8 @@ const App: React.FC = () => { // Also fetch following list for the mobile sidebar try { const followRes = await api.get('users/following_list/'); - setFollowing(followRes.data); + const followData = Array.isArray(followRes.data) ? followRes.data : (followRes.data.results || []); + setFollowing(followData); fetchNotifications(); } catch (err) { console.error('Failed to fetch following list');