diff --git a/src/api/advertisementMap/advertisementLocation.js b/src/api/advertisementMap/advertisementLocation.js index d77f776..daf57f5 100644 --- a/src/api/advertisementMap/advertisementLocation.js +++ b/src/api/advertisementMap/advertisementLocation.js @@ -1,9 +1,9 @@ import axios from "axios"; // Function to fetch data from the backend -export async function getRecentAdLocation(ad_type) { +export async function getRecentAdLocation(ad_type, duration) { try { - const response = await axios.get(`/getRecentAdLocation${ad_type}`); // Adjust the endpoint URL + const response = await axios.get(`/getRecentAdLocation?adtype=${ad_type}&duration=${duration}`); // Adjust the endpoint URL console.log(response.data); return response.data; } catch (error) { diff --git a/src/layouts/advertisement_map/map.js b/src/layouts/advertisement_map/map.js index 7d7d18f..8ad4976 100644 --- a/src/layouts/advertisement_map/map.js +++ b/src/layouts/advertisement_map/map.js @@ -70,7 +70,7 @@ const MapComponent = () => { } } else { try { - const data = await getRecentAdLocation(selectedData); + const data = await getRecentAdLocation(selectedData, selectedTime); setMarkers(data); console.log(markers); } catch (error) { @@ -79,7 +79,7 @@ const MapComponent = () => { } }; fetchData(); - }, [selectedData, test]); + }, [selectedData, test, selectedTime]); // const fetchData = async () => { // try { @@ -224,8 +224,8 @@ const MapComponent = () => { Overall Today Yesterday - Last Week - Last Month + Last Week + Last Month {/*