From 043fab9b9bfa0b61f79efa27a6ed8d06d6a18c19 Mon Sep 17 00:00:00 2001 From: Mamalizz Date: Fri, 28 Feb 2025 23:11:59 +0330 Subject: [PATCH] changed useCreateTicket --- .../api/tickets/useCreateTicket.ts | 26 +++++++------------ 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/frontend/composables/api/tickets/useCreateTicket.ts b/frontend/composables/api/tickets/useCreateTicket.ts index 6c65edc..cc63570 100644 --- a/frontend/composables/api/tickets/useCreateTicket.ts +++ b/frontend/composables/api/tickets/useCreateTicket.ts @@ -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; };