changed useCreateTicket

This commit is contained in:
Mamalizz
2025-02-28 23:11:59 +03:30
parent d4218296b4
commit 043fab9b9b
@@ -7,7 +7,7 @@ import { API_ENDPOINTS } from "~/constants";
export type CreateTicketRequest = {
ticket_category: string | undefined;
order: number | undefined;
order_id: number | undefined;
subject: string;
content: string;
attachments: ServerFile[];
@@ -21,23 +21,15 @@ const useCreateTicket = () => {
// methods
const handleCreateTicket = async (params: CreateTicketRequest) => {
const { data } = await axios.post(
API_ENDPOINTS.tickets.create,
{
message: {
content: params.content,
attachments: params.attachments,
},
subject: params.subject,
ticket_category: params.ticket_category,
order: params.order,
const { data } = await axios.post(API_ENDPOINTS.tickets.create, {
message: {
content: params.content,
attachments: params.attachments.map((i) => i.id),
},
{
headers: {
"Content-Type": "multipart/form-data",
},
}
);
subject: params.subject,
ticket_category: params.ticket_category,
order_id: params.order_id,
});
return data;
};