Development (#67)

* preliminary map for vehicles

* weird zoom bug

* passing react tests

* fixing warnings and updating snapshots

* update node environment to 14

* addressing comments by changing variable types and adding styles to home page title

* adding CODEOWNERS file

* fixing token error
This commit is contained in:
Drew Taylor
2021-08-03 16:34:37 -07:00
committed by GitHub
parent df50ef79b9
commit 0f377d5467
31 changed files with 1120 additions and 508 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,27 @@ 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),
getState: async (token, vin) => fetch(`${API_ENDPOINT}/carstate?vin=${vin}`, {
method: "GET",
headers: Object.assign({ "Content-Type": "application/json" }, getAuthHeaderOptions(token)),
})
.then(fetchRespHandler),
};
export default vehiclesAPI;