edit order
This commit is contained in:
@@ -15,7 +15,7 @@ const ProductList: FC = () => {
|
||||
const { data: products, refetch } = useGetProducts()
|
||||
const { mutate: deleteProduct, isPending: isDeleting } = useDeleteProduct()
|
||||
|
||||
const handleDelete = (id: number) => {
|
||||
const handleDelete = (id: string) => {
|
||||
deleteProduct(id, {
|
||||
onSuccess: () => {
|
||||
refetch()
|
||||
|
||||
@@ -88,7 +88,7 @@ export const useUpdateProduct = () => {
|
||||
|
||||
export const useDeleteProduct = () => {
|
||||
return useMutation({
|
||||
mutationFn: (id: number) => api.deleteProduct(id),
|
||||
mutationFn: (id: string) => api.deleteProduct(id),
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ export const updateProduct = async (id: string, params:CreateProductType) => {
|
||||
return data;
|
||||
};
|
||||
|
||||
export const deleteProduct = async (id: number) => {
|
||||
export const deleteProduct = async (id: string) => {
|
||||
const { data } = await axios.delete(`/admin/products/${id}`);
|
||||
return data;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user