Skip to content

Issue #51 — Frontend: React Query Hooks for Notifications #674

@yusuftomilola

Description

@yusuftomilola

Location: frontend/lib/react-query/hooks/notifications/

Description

The NotificationBell component and the full notifications page both need React Query hooks to fetch and mutate notification data. This issue implements the three hooks needed: fetching the list, marking a single notification as read, and marking all as read.

The project uses a shared apiClient at frontend/lib/apiClient.ts and centralised query keys in frontend/lib/react-query/keys/queryKeys.ts. Add any new keys there.

Acceptance Criteria

  • useGetNotifications.ts — wraps GET /notifications with page and limit params. Returns NotificationsResponse. Uses a staleTime of 30 seconds to avoid excessive refetching
  • useMarkNotificationRead.ts — wraps PATCH /notifications/:id/read. Accepts id: string as the mutation variable. On success, invalidates the notifications query so the unread count and list update
  • useMarkAllRead.ts — wraps PATCH /notifications/read-all. On success, invalidates the notifications query
  • All three files are marked "use client" and placed under frontend/lib/react-query/hooks/notifications/
  • Query keys for notifications are added to frontend/lib/react-query/keys/queryKeys.ts
  • npx tsc --noEmit passes with no errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions