create attibute value

This commit is contained in:
hamid zarghami
2026-01-25 11:43:57 +03:30
parent 69fb2786bc
commit d3eab9ed75
8 changed files with 189 additions and 1 deletions
+21
View File
@@ -7,6 +7,7 @@ import {
import * as api from "../service/ProductService";
import type {
CreateAttributeType,
CreateAttributeValueType,
CreateCategoryType,
CreateProductType,
} from "../types/Types";
@@ -139,3 +140,23 @@ export const useDeleteAttribute = () => {
mutationFn: (id: number) => api.deleteAttributes(id),
});
};
export const useGetAttributeValues = (id: number) => {
return useQuery({
queryKey: ["attrbute-values", id],
queryFn: () => api.getAttributeValues(id),
enabled: !!id,
});
};
export const useCreateAttributeValue = () => {
return useMutation({
mutationFn: ({
id,
params,
}: {
id: number;
params: CreateAttributeValueType;
}) => api.createAttributeValues(id, params),
});
};