CEC-4814 - Refactor vehicle_path endpoint (#407)
This commit is contained in:
@@ -112,10 +112,10 @@ export const VehicleProvider = ({ children }) => {
|
||||
}
|
||||
};
|
||||
|
||||
const getLocationsVehiclePaths = async (token, vinsParam) => {
|
||||
const getLocationsVehiclePaths = async (token, param, vins) => {
|
||||
try {
|
||||
setBusy(true);
|
||||
const result = await api.getLocationsVehiclePaths(token, vinsParam);
|
||||
const result = await api.getLocationsVehiclePaths(token, param, vins);
|
||||
if (result.error)
|
||||
throw new Error(`Get locations vehicle paths error. ${result.message}`);
|
||||
return result;
|
||||
|
||||
@@ -44,16 +44,9 @@ const ComponentVehiclePathsMap = (props) => {
|
||||
|
||||
const retrieveAndStoreLocations = (accessToken) => {
|
||||
let vinsToShowOnMap = [...props.vinsToShowOnMapColors.keys()];
|
||||
let vinsParam = ""
|
||||
for (let vinToShowOnMap of vinsToShowOnMap) {
|
||||
vinsParam += "vins="
|
||||
vinsParam += vinToShowOnMap
|
||||
vinsParam += "&"
|
||||
}
|
||||
vinsParam += "lookback_hours="
|
||||
vinsParam += props.lookbackHours
|
||||
let param = "lookback_hours=" + props.lookbackHours
|
||||
|
||||
return getLocationsVehiclePaths(accessToken, vinsParam)
|
||||
return getLocationsVehiclePaths(accessToken, param, vinsToShowOnMap)
|
||||
.then(async (result) => {
|
||||
let resultArray = Object.entries(result)
|
||||
const points = []
|
||||
|
||||
Reference in New Issue
Block a user