improvements to UI; display working
This commit is contained in:
@@ -32,6 +32,8 @@ export const VehicleProvider = ({ children }) => {
|
||||
const [years, setYears] = useState([]);
|
||||
const [flashpacks, setFlashpacks] = useState([]);
|
||||
const [totalFlashpacks, setTotalFlashpacks] = useState(0);
|
||||
const [flashpackECUMappings, setFlashpackECUMappings] = useState([])
|
||||
const [totalFlashpackECUMappings, setTotalFlashpackECUMappings] = useState(0)
|
||||
|
||||
const addConnections = async (cars, token) => {
|
||||
try {
|
||||
@@ -309,18 +311,18 @@ export const VehicleProvider = ({ children }) => {
|
||||
return result;
|
||||
};
|
||||
|
||||
const getFlashpackECUMappings = async (flashpack, model, year, options, token) => {
|
||||
const getFlashpackECUMappings = async (model, year, flashpack, options, token) => {
|
||||
let result;
|
||||
try {
|
||||
setBusy(true);
|
||||
|
||||
result = await api.getAllFlashpacks(options, token);
|
||||
result = await api.getFlashpackECUMappings(model, year, flashpack, options, token);
|
||||
if (result.error)
|
||||
throw new Error(`Get all flashpacks error. ${result.message}`);
|
||||
throw new Error(`Get flashpack ecu mappings error. ${result.message}`);
|
||||
|
||||
setFlashpacks(result.data);
|
||||
setFlashpackECUMappings(result.data);
|
||||
if (options && options.offset === 0 && result.total) {
|
||||
setTotalFlashpacks(result.total);
|
||||
setTotalFlashpackECUMappings(result.total);
|
||||
}
|
||||
} finally {
|
||||
setBusy(false);
|
||||
@@ -361,9 +363,9 @@ export const VehicleProvider = ({ children }) => {
|
||||
flashpacks,
|
||||
totalFlashpacks,
|
||||
getAllFlashpacks,
|
||||
totalFlashpackECUMappings,
|
||||
flashpackECUMappings,
|
||||
getFlashpackECUMappings,
|
||||
// addFlashpackECUMapping,
|
||||
// deleteFlashpackECUMapping,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
|
||||
Reference in New Issue
Block a user