crap
This commit is contained in:
11
src/api/product/useGetProductById.tsx
Normal file
11
src/api/product/useGetProductById.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import {ProductService} from "../../client";
|
||||
import {useQuery} from "@tanstack/react-query";
|
||||
|
||||
export const useGetProductById = (id: number) => {
|
||||
const {data, error, isLoading, refetch} = useQuery({
|
||||
queryKey: ['getProductById', id],
|
||||
queryFn: () => ProductService.getProductById({productId: id}),
|
||||
select: (data) => data
|
||||
});
|
||||
return {product: data, error, isLoading, refetch}
|
||||
}
|
||||
Reference in New Issue
Block a user