feat(notification): add scheduled email pipeline with prefs/groups and DLQ UI
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { Credentials, Task } from '../types'
|
||||
import type { Credentials, DlqItem, NotificationGroup, NotificationPrefs, Task } from '../types'
|
||||
import { clearSession, session, setSessionToken } from '../stores/session'
|
||||
|
||||
const API_BASE = 'http://localhost:8080/api/v1'
|
||||
@@ -115,3 +115,42 @@ export async function deleteTask(id: number) {
|
||||
method: 'DELETE',
|
||||
})
|
||||
}
|
||||
|
||||
export async function getNotificationPrefs() {
|
||||
return request<NotificationPrefs>('/notifications/prefs')
|
||||
}
|
||||
|
||||
export async function updateNotificationPrefs(payload: NotificationPrefs) {
|
||||
return request<NotificationPrefs>('/notifications/prefs', {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify(payload),
|
||||
})
|
||||
}
|
||||
|
||||
export async function listNotificationGroups() {
|
||||
return request<NotificationGroup[]>('/notifications/groups')
|
||||
}
|
||||
|
||||
export async function createNotificationGroup(payload: Omit<NotificationGroup, 'id'>) {
|
||||
return request<NotificationGroup>('/notifications/groups', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload),
|
||||
})
|
||||
}
|
||||
|
||||
export async function updateNotificationGroup(id: number, payload: Omit<NotificationGroup, 'id'>) {
|
||||
return request<NotificationGroup>(`/notifications/groups/${id}`, {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify(payload),
|
||||
})
|
||||
}
|
||||
|
||||
export async function deleteNotificationGroup(id: number) {
|
||||
return request<void>(`/notifications/groups/${id}`, {
|
||||
method: 'DELETE',
|
||||
})
|
||||
}
|
||||
|
||||
export async function listNotificationDlq(page = 1, pageSize = 20) {
|
||||
return request<DlqItem[]>(`/notifications/dlq?page=${page}&page_size=${pageSize}`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user