CEC-3943-display-ecu-vin-timeline (#303)

* first push

* fix test

* Fix test

* resolve comments

* fix undefined

* align items and change search field

* fix dates

* resolve comments

* fix lint

* fix test

---------

Co-authored-by: jwu-fisker <jwu@fiskerinc.com>
This commit is contained in:
das31
2023-03-27 12:05:40 -04:00
committed by GitHub
parent 234252a100
commit 8ece05a4b9
9 changed files with 420 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
import {
addQueryParams,
errorHandler,
fetchRespHandler,
getAuthHeaderOptions,
} from "../utils/http";
const API_ENDPOINT = process.env.REACT_APP_OTA_SERVICE_URL;
const DTCTimelineAPI = {
getDTCData: async (vin, ecu, startDate, endDate,search,token) => {
const queryParams = {
ecu,
start_time: startDate,
end_time: endDate,
...search,
};
const url = addQueryParams(`${API_ENDPOINT}/ecus/${vin}`, queryParams);
console.log(url)
return fetch(url, {
method: "GET",
headers: Object.assign(
{ "Content-Type": "application/json" },
getAuthHeaderOptions(token)
),
})
.then(fetchRespHandler)
.catch(errorHandler);
},
};
export default DTCTimelineAPI;