mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-29 18:13:47 +00:00
refactor: migrate to eslint flat config and format codebase with prettier
- Remove legacy .eslintrc.cjs and .eslintignore - Add eslint.config.js with flat config, security rules (no-eval, no-implied-eval, no-new-func, no-script-url) - Add .prettierrc and .prettierignore - Format entire codebase with prettier
This commit is contained in:
@@ -1,64 +1,80 @@
|
||||
import apiClient from './client'
|
||||
import type { TicketNotificationList, UnreadCountResponse } from '../types'
|
||||
import apiClient from './client';
|
||||
import type { TicketNotificationList, UnreadCountResponse } from '../types';
|
||||
|
||||
export const ticketNotificationsApi = {
|
||||
// User notifications
|
||||
getNotifications: async (unreadOnly = false, limit = 50, offset = 0): Promise<TicketNotificationList> => {
|
||||
getNotifications: async (
|
||||
unreadOnly = false,
|
||||
limit = 50,
|
||||
offset = 0,
|
||||
): Promise<TicketNotificationList> => {
|
||||
const response = await apiClient.get('/cabinet/tickets/notifications', {
|
||||
params: { unread_only: unreadOnly, limit, offset }
|
||||
})
|
||||
return response.data
|
||||
params: { unread_only: unreadOnly, limit, offset },
|
||||
});
|
||||
return response.data;
|
||||
},
|
||||
|
||||
getUnreadCount: async (): Promise<UnreadCountResponse> => {
|
||||
const response = await apiClient.get('/cabinet/tickets/notifications/unread-count')
|
||||
return response.data
|
||||
const response = await apiClient.get('/cabinet/tickets/notifications/unread-count');
|
||||
return response.data;
|
||||
},
|
||||
|
||||
markAsRead: async (notificationId: number): Promise<{ success: boolean }> => {
|
||||
const response = await apiClient.post(`/cabinet/tickets/notifications/${notificationId}/read`)
|
||||
return response.data
|
||||
const response = await apiClient.post(`/cabinet/tickets/notifications/${notificationId}/read`);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
markAllAsRead: async (): Promise<{ success: boolean; marked_count: number }> => {
|
||||
const response = await apiClient.post('/cabinet/tickets/notifications/read-all')
|
||||
return response.data
|
||||
const response = await apiClient.post('/cabinet/tickets/notifications/read-all');
|
||||
return response.data;
|
||||
},
|
||||
|
||||
markTicketAsRead: async (ticketId: number): Promise<{ success: boolean; marked_count: number }> => {
|
||||
const response = await apiClient.post(`/cabinet/tickets/notifications/ticket/${ticketId}/read`)
|
||||
return response.data
|
||||
markTicketAsRead: async (
|
||||
ticketId: number,
|
||||
): Promise<{ success: boolean; marked_count: number }> => {
|
||||
const response = await apiClient.post(`/cabinet/tickets/notifications/ticket/${ticketId}/read`);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
// Admin notifications
|
||||
getAdminNotifications: async (unreadOnly = false, limit = 50, offset = 0): Promise<TicketNotificationList> => {
|
||||
const params: Record<string, unknown> = { limit, offset }
|
||||
getAdminNotifications: async (
|
||||
unreadOnly = false,
|
||||
limit = 50,
|
||||
offset = 0,
|
||||
): Promise<TicketNotificationList> => {
|
||||
const params: Record<string, unknown> = { limit, offset };
|
||||
if (unreadOnly) {
|
||||
params.unread_only = true
|
||||
params.unread_only = true;
|
||||
}
|
||||
const response = await apiClient.get('/cabinet/admin/tickets/notifications', { params })
|
||||
return response.data
|
||||
const response = await apiClient.get('/cabinet/admin/tickets/notifications', { params });
|
||||
return response.data;
|
||||
},
|
||||
|
||||
getAdminUnreadCount: async (): Promise<UnreadCountResponse> => {
|
||||
const response = await apiClient.get('/cabinet/admin/tickets/notifications/unread-count')
|
||||
return response.data
|
||||
const response = await apiClient.get('/cabinet/admin/tickets/notifications/unread-count');
|
||||
return response.data;
|
||||
},
|
||||
|
||||
markAdminAsRead: async (notificationId: number): Promise<{ success: boolean }> => {
|
||||
const response = await apiClient.post(`/cabinet/admin/tickets/notifications/${notificationId}/read`)
|
||||
return response.data
|
||||
const response = await apiClient.post(
|
||||
`/cabinet/admin/tickets/notifications/${notificationId}/read`,
|
||||
);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
markAllAdminAsRead: async (): Promise<{ success: boolean; marked_count: number }> => {
|
||||
const response = await apiClient.post('/cabinet/admin/tickets/notifications/read-all')
|
||||
return response.data
|
||||
const response = await apiClient.post('/cabinet/admin/tickets/notifications/read-all');
|
||||
return response.data;
|
||||
},
|
||||
|
||||
markAdminTicketAsRead: async (ticketId: number): Promise<{ success: boolean; marked_count: number }> => {
|
||||
const response = await apiClient.post(`/cabinet/admin/tickets/notifications/ticket/${ticketId}/read`)
|
||||
return response.data
|
||||
markAdminTicketAsRead: async (
|
||||
ticketId: number,
|
||||
): Promise<{ success: boolean; marked_count: number }> => {
|
||||
const response = await apiClient.post(
|
||||
`/cabinet/admin/tickets/notifications/ticket/${ticketId}/read`,
|
||||
);
|
||||
return response.data;
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
export default ticketNotificationsApi
|
||||
export default ticketNotificationsApi;
|
||||
|
||||
Reference in New Issue
Block a user