32 lines
970 B
JavaScript
32 lines
970 B
JavaScript
import {
|
|
addQueryParams, errorHandler, fetchRespHandler, getAuthHeaderOptions
|
|
} from "../utils/http";
|
|
|
|
const API_ENDPOINT = process.env.REACT_APP_OTA_SERVICE_URL;
|
|
|
|
const canSignalAPI = {
|
|
|
|
getCanSignalsVin: async (vin, timestamp_start, timestamp_end, can_signals, select_all, token) =>
|
|
fetch(addQueryParams(`${API_ENDPOINT}/can_signals_export`, { vin, timestamp_start, timestamp_end, can_signals, select_all }), {
|
|
method: "GET",
|
|
headers: Object.assign(
|
|
{ "Content-Type": "application/json" },
|
|
getAuthHeaderOptions(token)
|
|
),
|
|
responseType: "blob"
|
|
})
|
|
.catch(errorHandler),
|
|
|
|
getCanSignalList: async (token) =>
|
|
fetch(addQueryParams(`${API_ENDPOINT}/can_signals_list`), {
|
|
method: "GET",
|
|
headers: Object.assign(
|
|
{ "Content-Type": "application/json" },
|
|
getAuthHeaderOptions(token)
|
|
),
|
|
})
|
|
.then(fetchRespHandler)
|
|
.catch(errorHandler),
|
|
};
|
|
export default canSignalAPI;
|