create attibute value
This commit is contained in:
@@ -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),
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user