Merge branch 'release/0.9.0'
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -5,6 +5,7 @@ import api from "../../services/vehiclesAPI";
|
||||
import { validateVIN } from "../../utils/validationSupplier";
|
||||
|
||||
const VehicleContext = React.createContext();
|
||||
export const VehicleConsumer = VehicleContext.Consumer;
|
||||
|
||||
const validateAdd = (vehicle) => {
|
||||
if (vehicle == null) {
|
||||
@@ -299,7 +300,7 @@ export const VehicleProvider = ({ children }) => {
|
||||
updateVehicle,
|
||||
getFleets,
|
||||
getVersionLog,
|
||||
uploadConfig
|
||||
uploadConfig,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -92,6 +92,10 @@ export const VehicleProvider = ({ children }) => {
|
||||
return <div data-testid="mocked-vehicleprovider">{children}</div>;
|
||||
};
|
||||
|
||||
export const VehicleConsumer = ({ children }) => {
|
||||
return children();
|
||||
};
|
||||
|
||||
export const useVehicleContext = () => ({
|
||||
busy,
|
||||
models,
|
||||
|
||||
Reference in New Issue
Block a user