You've already forked agentic-coding-workflow
feat(web): fetch-based api client with 401 handling and tests
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { request } from './client'
|
||||
import type { Notification } from '@/stores/notifications'
|
||||
|
||||
export const notificationsApi = {
|
||||
list: (unreadOnly = false, limit = 50) =>
|
||||
request<{ items: Notification[] }>(
|
||||
`/api/v1/notifications?unread=${unreadOnly}&limit=${limit}`,
|
||||
),
|
||||
unreadCount: () =>
|
||||
request<{ count: number }>('/api/v1/notifications/unread-count'),
|
||||
markRead: (id: string) =>
|
||||
request<void>(`/api/v1/notifications/${id}/read`, { method: 'PATCH' }),
|
||||
markAllRead: () =>
|
||||
request<void>('/api/v1/notifications/read-all', { method: 'PATCH' }),
|
||||
}
|
||||
Reference in New Issue
Block a user