From 534c138bb89dc762dd6f25b790a98b63fca92964 Mon Sep 17 00:00:00 2001 From: marzban-dev Date: Thu, 26 Feb 2026 18:19:20 +0330 Subject: [PATCH 1/2] Connect the contact us to api and connect the validations --- .../api/tickets/useCreateContactUsTicket.ts | 33 +++ frontend/constants/index.ts | 1 + frontend/pages/contact-us.vue | 210 ++++++++++++++++-- 3 files changed, 220 insertions(+), 24 deletions(-) create mode 100644 frontend/composables/api/tickets/useCreateContactUsTicket.ts diff --git a/frontend/composables/api/tickets/useCreateContactUsTicket.ts b/frontend/composables/api/tickets/useCreateContactUsTicket.ts new file mode 100644 index 0000000..ecbc03b --- /dev/null +++ b/frontend/composables/api/tickets/useCreateContactUsTicket.ts @@ -0,0 +1,33 @@ +// imports + +import { useMutation } from "@tanstack/vue-query"; +import { API_ENDPOINTS } from "~/constants"; + +// types + +export type CreateContactUsTicketRequest = { + full_name: string; + email: string; + phone: string; + type: "ORDER_FOLLOW_UP" | "SUGGESTION" | "COMPLAINT"; + message: string; +}; + +const useCreateContactUsTicket = () => { + // state + + const { $axios: axios } = useNuxtApp(); + + // methods + + const handleCreateContactUsTicket = async (params: CreateContactUsTicketRequest) => { + const { data } = await axios.post(API_ENDPOINTS.tickets.contact_us_ticket, params); + return data; + }; + + return useMutation({ + mutationFn: (messageData: CreateContactUsTicketRequest) => handleCreateContactUsTicket(messageData), + }); +}; + +export default useCreateContactUsTicket; diff --git a/frontend/constants/index.ts b/frontend/constants/index.ts index d30e85d..f5b7256 100644 --- a/frontend/constants/index.ts +++ b/frontend/constants/index.ts @@ -51,6 +51,7 @@ export const API_ENDPOINTS = { delete_attachment: "/tickets/attachment/delete", get_one: "/tickets", create_message: "/tickets/message/create", + contact_us_ticket: "/tickets/contact-us/create", }, orders: { get_all: "/order/all", diff --git a/frontend/pages/contact-us.vue b/frontend/pages/contact-us.vue index 1d38a44..d889e4a 100644 --- a/frontend/pages/contact-us.vue +++ b/frontend/pages/contact-us.vue @@ -1,19 +1,54 @@ diff --git a/frontend/types/global.d.ts b/frontend/types/global.d.ts index 2d0f492..205252a 100644 --- a/frontend/types/global.d.ts +++ b/frontend/types/global.d.ts @@ -112,6 +112,8 @@ declare global { best_deal_price_before_discount: string; best_deal_price_after_discount: string; best_deal_discount: number; + customer_pickup_title: null | string; + customer_pickup_description: null | string; }; type ProductListItem = Pick<