19 lines
507 B
TypeScript
19 lines
507 B
TypeScript
import { useQuery } from "@tanstack/react-query";
|
|
import * as api from "../service/Service";
|
|
|
|
export const useGetCompare = (productIds: string[]) => {
|
|
return useQuery({
|
|
queryKey: ["compare", productIds],
|
|
queryFn: () => api.getCompare(productIds),
|
|
enabled: !!productIds,
|
|
});
|
|
};
|
|
|
|
export const useSearchCompareProduct = (productId?: string) => {
|
|
return useQuery({
|
|
queryKey: ["compare", productId],
|
|
queryFn: () => api.searchComparProduct(productId),
|
|
enabled: !!productId,
|
|
});
|
|
};
|