diff --git a/src/pages/Products/ModelViewer/CarModelContainer.jsx b/src/pages/Products/ModelViewer/CarModelContainer.jsx index c58f4dd..a2b44d0 100644 --- a/src/pages/Products/ModelViewer/CarModelContainer.jsx +++ b/src/pages/Products/ModelViewer/CarModelContainer.jsx @@ -50,7 +50,7 @@ const CarModelListContainer = () => { setLoading(true); // Set loading to true before fetching data let models = []; if (selectedBrand && selectedBrand.id) { - models = await getCarModelsByBrandId(selectedBrand.id); + models = await getCarModelsByBrandId(selectedBrand.id, searchTerm); } else { models = await getCarModels(searchTerm); } diff --git a/src/services/BrandService.js b/src/services/BrandService.js index e6a8937..6c3b402 100644 --- a/src/services/BrandService.js +++ b/src/services/BrandService.js @@ -7,8 +7,8 @@ const getAllBrands = async (name = '') => { return Array.isArray(result.response) ? result.response.map(brand => new Brand(brand)) : []; }; -const getCarModelsByBrandId = async (brandId) => { - const result = await axios.get(`/brand/${brandId}/models`); +const getCarModelsByBrandId = async (brandId, name) => { + const result = await axios.get(`/brand/${brandId}/models?name=${name}`); return Array.isArray(result.response) ? result.response.map(model => new CarModel(model)) : []; };