mirror of
https://github.com/narrrl/holy-flavor-rater.git
synced 2026-11-03 16:41:27 +01:00
fixed ts error
This commit is contained in:
1 parent
edd5d92939
commit
0e9ea23d98
2 files changed
+5
-2
No files matched your search
@@ -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')
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in new issue
Block a user