diff --git a/src/pages/admin/admin.js b/src/pages/admin/admin.js index 10fd2dea59b54a209056067bae53dfa00988f9f2..9afb434b15db63dc4702fde1c138b1eaed7e9afc 100644 --- a/src/pages/admin/admin.js +++ b/src/pages/admin/admin.js @@ -102,14 +102,21 @@ const AdminPageView = () => { // Add a new location const addLocation = async (location) => { - // const { Title, Description, city, street_address, lat, lon, total_spaces, spaces_available } = location; - - location.spaces_available = location.total_spaces; + const { Title, Description, city, street_address, + lat, lon, total_spaces} = location; + console.log(JSON.stringify({ - ...location + Title: Title, + Description: Description, + city: city, + street_address: street_address, + lat: lat, + lon: lon, + total_spaces: total_spaces, + spaces_available: total_spaces, })); const baseUrl = process.env.REACT_APP_LOCATION_SERVICE_ENDPOINT; - + try { const response = await fetch(`${baseUrl}/location/parking-locations`, { @@ -118,7 +125,7 @@ const AdminPageView = () => { Authorization: `Bearer ${localStorage.getItem("token")}`, }, body: JSON.stringify({ - ...location + ...location }), }); if (!response.ok) {