26 lines
541 B
TypeScript
26 lines
541 B
TypeScript
// imports
|
|
|
|
import { useMutation } from "@tanstack/vue-query";
|
|
import { API_ENDPOINTS } from "~/constants";
|
|
|
|
const useDeleteDiscountCode = () => {
|
|
// state
|
|
|
|
const { $axios: axios } = useNuxtApp();
|
|
|
|
// methods
|
|
|
|
const handleDeleteDiscountCode = async () => {
|
|
const { data } = await axios.delete(
|
|
API_ENDPOINTS.orders.cart.delete_discount
|
|
);
|
|
return data;
|
|
};
|
|
|
|
return useMutation({
|
|
mutationFn: () => handleDeleteDiscountCode(),
|
|
});
|
|
};
|
|
|
|
export default useDeleteDiscountCode;
|