Skip to content

Commit

Permalink
Update advertisement map
Browse files Browse the repository at this point in the history
  • Loading branch information
NadunSanjeevana committed Sep 12, 2023
1 parent ab01d0d commit cd0a97e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/api/advertisementMap/advertisementLocation.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions src/layouts/advertisement_map/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -79,7 +79,7 @@ const MapComponent = () => {
}
};
fetchData();
}, [selectedData, test]);
}, [selectedData, test, selectedTime]);

// const fetchData = async () => {
// try {
Expand Down Expand Up @@ -224,8 +224,8 @@ const MapComponent = () => {
<MenuItem value="Overall">Overall</MenuItem>
<MenuItem value="Today">Today</MenuItem>
<MenuItem value="Yesterday">Yesterday</MenuItem>
<MenuItem value="Last Week">Last Week</MenuItem>
<MenuItem value="Last Month">Last Month</MenuItem>
<MenuItem value="LastWeek">Last Week</MenuItem>
<MenuItem value="LastMonth">Last Month</MenuItem>
</MDInput>
</MDBox>
{/* <MDBox color="text" px={2}>
Expand Down

0 comments on commit cd0a97e

Please sign in to comment.