19 lines
534 B
TypeScript
19 lines
534 B
TypeScript
import type { NotificationItem } from './dto/notification'
|
|
import { extractItems } from '~/utils/api'
|
|
|
|
export const listUnreadNotifications = async () => {
|
|
const api = useApi()
|
|
const data = await api.get<NotificationItem[] | { 'hydra:member'?: NotificationItem[] }>(
|
|
'/notifications/unread',
|
|
{},
|
|
{ toast: false }
|
|
)
|
|
|
|
return extractItems<NotificationItem>(data)
|
|
}
|
|
|
|
export const markAllNotificationsRead = async () => {
|
|
const api = useApi()
|
|
return api.post('/notifications/mark-all-read', {}, { toast: false })
|
|
}
|