CEC-4498 update fleetsAPI.addFleetVehicle to send vehicle in an array (#351)

* CEC-4498 update fleet-vehicle-add api to take an array of vehicles
This commit is contained in:
Tristan Timblin
2023-06-12 22:41:55 -04:00
committed by GitHub
parent a5f32151b2
commit f74c717377
11 changed files with 1078 additions and 646 deletions

View File

@@ -62,8 +62,8 @@ const fleetsAPI = {
getFleetVehicles: async () => {
return { data: vehicles };
},
addFleetVehicle: async (_name, vehicle) => {
vehicles.push(vehicle.vin);
addFleetVehicles: async (_name, vehicle) => {
vehicles.push(...vehicle.vins);
return vehicle;
},
deleteFleetVehicle: async (_name, vehicle) => {

View File

@@ -73,14 +73,14 @@ const fleetsAPI = {
.then(fetchRespHandler)
.catch(errorHandler),
addFleetVehicle: async (name, vehicle, token) =>
addFleetVehicles: async (name, vehicles, token) =>
fetch(`${API_ENDPOINT}/fleet/${name}/vehicle`, {
method: "POST",
headers: Object.assign(
{ "Content-Type": "application/json" },
getAuthHeaderOptions(token)
),
body: JSON.stringify(vehicle),
body: JSON.stringify(vehicles),
})
.then(fetchRespHandler)
.catch(errorHandler),