changed useCreateTicket
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user