compare
This commit is contained in:
@@ -5,7 +5,18 @@ import { CompareResponse } from "../types/Types";
|
||||
export const getCompare = async (
|
||||
productIds: string[]
|
||||
): Promise<CompareResponse> => {
|
||||
const { data } = await axios.get(`/product/compare?productIds=${productIds}`);
|
||||
console.log("API call - productIds:", productIds);
|
||||
|
||||
// روش اول: ارسال آرایه به صورت جداگانه
|
||||
const params = new URLSearchParams();
|
||||
productIds.forEach((id) => {
|
||||
params.append("productIds", id);
|
||||
});
|
||||
|
||||
console.log("Final URL:", `/product/compare?${params.toString()}`);
|
||||
|
||||
const { data } = await axios.get(`/product/compare?${params.toString()}`);
|
||||
console.log("API response:", data);
|
||||
return data;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user