close ticket
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import * as api from "../service/TicketService";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { type AddMessageTicketType, type CreateTicketPayload, type CreateTicketType } from "../types/TicketTypes";
|
||||
import {
|
||||
type AddMessageTicketType,
|
||||
type CloseTicketParamsType,
|
||||
type CreateTicketPayload,
|
||||
type CreateTicketType,
|
||||
} from "../types/TicketTypes";
|
||||
|
||||
export const useGetTickets = (status?: string) => {
|
||||
return useQuery({
|
||||
@@ -82,7 +87,13 @@ export const useAddMessageTicket = (id: string) => {
|
||||
export const useCloseTicket = () => {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: (id: string) => api.closeTicket(id),
|
||||
mutationFn: ({
|
||||
id,
|
||||
params,
|
||||
}: {
|
||||
id: string;
|
||||
params: CloseTicketParamsType;
|
||||
}) => api.closeTicket(id, params),
|
||||
onSuccess: () => {
|
||||
queryClient.refetchQueries({
|
||||
queryKey: ["tickets"],
|
||||
|
||||
Reference in New Issue
Block a user