preliminary map for vehicles

This commit is contained in:
Drew Taylor
2021-07-14 10:12:59 -07:00
parent ab37cd598f
commit c0a11de056
9 changed files with 257 additions and 180 deletions

View File

@@ -9,10 +9,10 @@ const vehiclesAPI = {
body: JSON.stringify(vehicle),
})
.then(fetchRespHandler),
getVehicles: async (search, token) => {
const u = addQueryParams(`${API_ENDPOINT}/vehicles`, search);
return fetch(u, {
return fetch(u, {
method: "GET",
headers: Object.assign({ "Content-Type": "application/json" }, getAuthHeaderOptions(token)),
})
@@ -20,10 +20,10 @@ const vehiclesAPI = {
},
getModels: async (token) => fetch(`${API_ENDPOINT}/vehiclemodels`, {
method: "GET",
headers: Object.assign({ "Content-Type": "application/json" }, getAuthHeaderOptions(token)),
})
.then(fetchRespHandler),
method: "GET",
headers: Object.assign({ "Content-Type": "application/json" }, getAuthHeaderOptions(token)),
})
.then(fetchRespHandler),
getYears: async (token) => fetch(`${API_ENDPOINT}/vehicleyears`, {
method: "GET",
@@ -39,15 +39,22 @@ const vehiclesAPI = {
}),
})
.then(fetchRespHandler),
getConnections: async (vins, token) => {
const u = `${API_ENDPOINT}/carsconnected?vins=${vins.join(",")}`
return fetch(u, {
return fetch(u, {
method: "GET",
headers: Object.assign({ "Content-Type": "application/json" }, getAuthHeaderOptions(token)),
})
.then(fetchRespHandler)
},
getLocations: async (token) => fetch(`${API_ENDPOINT}/carslocations`, {
method: "GET",
headers: Object.assign({ "Content-Type": "application/json" }, getAuthHeaderOptions(token)),
})
.then(fetchRespHandler),
};
export default vehiclesAPI;