Connect the contact us to api and connect the validations

This commit is contained in:
marzban-dev
2026-02-26 18:19:20 +03:30
parent ec9bb87a6a
commit 534c138bb8
3 changed files with 220 additions and 24 deletions
@@ -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;