Skip to content
Snippets Groups Projects
Commit 17384c03 authored by Tonge, Marcus A (UG - Comp Sci & Elec Eng)'s avatar Tonge, Marcus A (UG - Comp Sci & Elec Eng)
Browse files

Update JSON admin

parent 92ae5f71
No related branches found
No related tags found
No related merge requests found
......@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment