27 lines
763 B
TypeScript
27 lines
763 B
TypeScript
import apiClient from './client'
|
|
import type { Notification, ApiResponse, TargetFilters } from '@/types/api'
|
|
|
|
export interface NotificationsListParams {
|
|
offset?: number
|
|
limit?: number
|
|
status?: string
|
|
}
|
|
|
|
export interface CreateNotificationRequest {
|
|
title: string
|
|
message_html: string
|
|
photo_base64?: string
|
|
photo_file_name?: string
|
|
targets: TargetFilters
|
|
}
|
|
|
|
export const notificationsApi = {
|
|
getList: (params: NotificationsListParams = {}) =>
|
|
apiClient.get<ApiResponse<Notification[]>>('/notifications', { params }),
|
|
|
|
getById: (id: number) =>
|
|
apiClient.get<Notification>(`/notifications/${id}`),
|
|
|
|
create: (data: CreateNotificationRequest) =>
|
|
apiClient.post<Notification>('/notifications', data),
|
|
} |