Add package updates, car updates, and vehicle screens (#25)

This commit is contained in:
John Wu
2021-03-31 17:42:31 -07:00
committed by GitHub
parent 2d1faa8fb7
commit 17f81822c0
33 changed files with 2409 additions and 699 deletions

View File

@@ -1,4 +1,4 @@
import { getAuthHeaderOptions, fetchRespHandler } from "../utils/http"
import { getAuthHeaderOptions, fetchRespHandler, addQueryParams } from "../utils/http"
const API_ENDPOINT = process.env.REACT_APP_UPLOAD_SERVICE_URL || "https://gw-dev.fiskerdps.com/ota_update";
@@ -9,12 +9,16 @@ const vehiclesAPI = {
body: JSON.stringify(vehicle),
})
.then(fetchRespHandler),
getVehicles: async (search, token) => fetch(`${API_ENDPOINT}/vehicles`, {
method: "GET",
headers: Object.assign({ "Content-Type": "application/json" }, getAuthHeaderOptions(token)),
})
.then(fetchRespHandler)
getVehicles: async (search, token) => {
const u = addQueryParams(`${API_ENDPOINT}/vehicles`, search);
return fetch(u, {
method: "GET",
headers: Object.assign({ "Content-Type": "application/json" }, getAuthHeaderOptions(token)),
})
.then(fetchRespHandler);
},
};
export default vehiclesAPI;