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:
@@ -122,14 +122,17 @@ export const FleetProvider = ({ children }) => {
|
||||
}
|
||||
};
|
||||
|
||||
const addFleetVehicle = async (name, vehicle, token) => {
|
||||
const addFleetVehicles = async (name, vehicles, token) => {
|
||||
try {
|
||||
setBusy(true);
|
||||
|
||||
validateFleetName(name);
|
||||
validateVIN(vehicle.vin);
|
||||
|
||||
const result = await api.addFleetVehicle(name, vehicle, token);
|
||||
for (const vin of vehicles.vins) {
|
||||
validateVIN(vin);
|
||||
}
|
||||
|
||||
const result = await api.addFleetVehicles(name, vehicles, token);
|
||||
if (result.error) {
|
||||
throw new Error(`Add fleet vehicle error. ${result.message}`);
|
||||
}
|
||||
@@ -250,7 +253,7 @@ export const FleetProvider = ({ children }) => {
|
||||
fleetVehicles,
|
||||
totalFleetVehicles,
|
||||
getFleetVehicles,
|
||||
addFleetVehicle,
|
||||
addFleetVehicles,
|
||||
deleteFleetVehicle,
|
||||
|
||||
fleetCANFilters,
|
||||
|
||||
Reference in New Issue
Block a user