This commit is contained in:
marzban-dev
2025-11-01 20:35:55 +03:30
parent 6524ae7605
commit 4fde6357d1
16 changed files with 292 additions and 67 deletions
@@ -0,0 +1,29 @@
// imports
import { useMutation } from "@tanstack/vue-query";
import { API_ENDPOINTS } from "~/constants";
// types
export type SaveProductRequest = {
product_slug: string;
};
const useSaveProduct = () => {
// state
const { $axios: axios } = useNuxtApp();
// methods
const handleSaveProduct = async (variables: SaveProductRequest) => {
const { data } = await axios.post(`${API_ENDPOINTS.product.save}`, variables);
return data;
};
return useMutation({
mutationFn: (variables: SaveProductRequest) => handleSaveProduct(variables),
});
};
export default useSaveProduct;