create attribute

This commit is contained in:
hamid zarghami
2026-01-25 09:40:41 +03:30
parent 5fad34cc84
commit a37a7191dd
9 changed files with 165 additions and 12 deletions
+12 -1
View File
@@ -5,7 +5,11 @@ import {
useQueryClient,
} from "@tanstack/react-query";
import * as api from "../service/ProductService";
import type { CreateCategoryType, CreateProductType } from "../types/Types";
import type {
CreateAttributeType,
CreateCategoryType,
CreateProductType,
} from "../types/Types";
export const useGetCategory = () => {
return useQuery({
@@ -86,3 +90,10 @@ export const useDeleteProduct = () => {
mutationFn: (id: number) => api.deleteProduct(id),
});
};
export const useCreateAttribute = () => {
return useMutation({
mutationFn: ({ id, params }: { id: number; params: CreateAttributeType }) =>
api.createAttribute(id, params),
});
};