added use delete attachment

This commit is contained in:
Mamalizz
2025-02-23 23:25:04 +03:30
parent 363fca8721
commit 4e09bc81b2
@@ -0,0 +1,36 @@
// imports
import { useMutation } from "@tanstack/vue-query";
import { API_ENDPOINTS } from "~/constants";
// types
export type DeleteAttachmentRequest = {
id: number | string;
};
// methods
export const handleDeleteAttachment = async ({
id,
}: DeleteAttachmentRequest) => {
// state
const { $axios: axios } = useNuxtApp();
const { data } = await axios.delete(
`${API_ENDPOINTS.tickets.delete_attachment}/${id}`
);
return data;
};
// composable
const useDeleteAttachment = () => {
return useMutation({
mutationFn: (data: DeleteAttachmentRequest) =>
handleDeleteAttachment({ ...data }),
});
};
export default useDeleteAttachment;