49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import { apiClient } from '@services';
|
|
import {
|
|
SupportTicket,
|
|
CreateTicketPayload,
|
|
PostMessagePayload,
|
|
SupportMessage,
|
|
} from '@interfaces';
|
|
|
|
export const createTicketApi = async (payload: CreateTicketPayload) => {
|
|
return await apiClient.post<SupportTicket>('/support/tickets', payload);
|
|
};
|
|
|
|
export const getMyTicketsApi = async () => {
|
|
return await apiClient.get<SupportTicket[]>('/support/tickets');
|
|
};
|
|
|
|
export const getTicketDetailsApi = async (ticketId: string) => {
|
|
return await apiClient.get<SupportTicket>(`/support/tickets/${ticketId}`);
|
|
};
|
|
|
|
export const postMessageApi = async (
|
|
ticketId: string,
|
|
payload: PostMessagePayload,
|
|
) => {
|
|
return await apiClient.post<SupportMessage>(
|
|
`/support/tickets/${ticketId}/messages`,
|
|
payload,
|
|
);
|
|
};
|
|
|
|
export const reopenTicketApi = async (ticketId: string) => {
|
|
return await apiClient.patch<SupportTicket>(
|
|
`/support/tickets/${ticketId}/reopen`,
|
|
{},
|
|
);
|
|
};
|
|
|
|
export const uploadSupportAttachmentApi = async (formData: FormData) => {
|
|
return await apiClient.post<{ id: string; filename: string; url: string }>(
|
|
'/support/upload',
|
|
formData,
|
|
{
|
|
headers: {
|
|
'Content-Type': 'multipart/form-data',
|
|
},
|
|
},
|
|
);
|
|
};
|