mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43:47 +00:00
Refactor getAdminNotifications to streamline parameter handling for API requests, improving readability and maintainability.
This commit is contained in:
@@ -32,9 +32,11 @@ export const ticketNotificationsApi = {
|
|||||||
|
|
||||||
// Admin notifications
|
// Admin notifications
|
||||||
getAdminNotifications: async (unreadOnly = false, limit = 50, offset = 0): Promise<TicketNotificationList> => {
|
getAdminNotifications: async (unreadOnly = false, limit = 50, offset = 0): Promise<TicketNotificationList> => {
|
||||||
const response = await apiClient.get('/cabinet/admin/tickets/notifications', {
|
const params: Record<string, unknown> = { limit, offset }
|
||||||
params: { unread_only: unreadOnly, limit, offset }
|
if (unreadOnly) {
|
||||||
})
|
params.unread_only = true
|
||||||
|
}
|
||||||
|
const response = await apiClient.get('/cabinet/admin/tickets/notifications', { params })
|
||||||
return response.data
|
return response.data
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user