CEC-4241 - Add trouble code to DTC search (#356)

This commit is contained in:
Paul Adamsen
2023-06-13 15:54:04 -04:00
committed by GitHub
parent 99e2058ffd
commit a68c00b4ad
4 changed files with 59 additions and 6 deletions

View File

@@ -9,15 +9,15 @@ export const DTCTimelineProvider = ({ children }) => {
const [dtcData, setDTCData] = useState([]);
const [total, setTotal] = useState(0)
const getDTCData = async (vin, ecu, startDate, endDate, search,token) => {
const getDTCData = async (vin, ecu, troubleCode, startDate, endDate, search, token) => {
try {
setBusy(true);
const result = await api.getDTCData(vin, ecu, startDate, endDate, search,token);
const result = await api.getDTCData(vin, ecu, troubleCode, startDate, endDate, search, token);
if (result.error) {
throw new Error(`Get DTC data error. ${result.message}`);
}
setDTCData(result.data ?? []);
if (result.total){
if (result.total) {
setTotal(result.total)
}
return result;