CEC-5904: Added DTC timeline export feature (#517)

This commit is contained in:
Pankaj Yadav
2024-07-16 11:23:45 +05:30
committed by GitHub
parent ab5569b61b
commit f0ae149fab
4 changed files with 118 additions and 4 deletions

View File

@@ -28,6 +28,27 @@ const DTCTimelineAPI = {
.then(fetchRespHandler)
.catch(errorHandler);
},
exportDTCData: async (vin, ecu, troubleCode, startDate, endDate, search, token) => {
const queryParams = {
ecu,
trouble_code: troubleCode,
start_time: startDate,
end_time: endDate,
decode: true,
...search,
};
const url = addQueryParams(`${API_ENDPOINT}/dtc_snapshot_export/${vin}`, queryParams);
return fetch(url, {
method: "GET",
headers: Object.assign(
{ "Content-Type": "application/json" },
getAuthHeaderOptions(token)
),
responseType: "blob"
})
.catch(errorHandler);
},
};
export default DTCTimelineAPI;