CEC-5443 - Ability to add Flashpack/ECU mappings
This commit is contained in:
@@ -30,6 +30,8 @@ export const VehicleProvider = ({ children }) => {
|
||||
const [totalFleets, setTotalFleets] = useState(0);
|
||||
const [models, setModels] = useState([]);
|
||||
const [years, setYears] = useState([]);
|
||||
const [flashpacks, setFlashpacks] = useState([]);
|
||||
const [totalFlashpacks, setTotalFlashpacks] = useState(0);
|
||||
|
||||
const addConnections = async (cars, token) => {
|
||||
try {
|
||||
@@ -287,6 +289,26 @@ export const VehicleProvider = ({ children }) => {
|
||||
}
|
||||
};
|
||||
|
||||
const getAllFlashpacks = async (options, token) => {
|
||||
let result;
|
||||
try {
|
||||
setBusy(true);
|
||||
|
||||
result = await api.getAllFlashpacks(options, token);
|
||||
if (result.error)
|
||||
throw new Error(`Get all flashpacks error. ${result.message}`);
|
||||
|
||||
setFlashpacks(result.data);
|
||||
if (options && options.offset === 0 && result.total) {
|
||||
setTotalFlashpacks(result.total);
|
||||
}
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
return (
|
||||
<VehicleContext.Provider
|
||||
value={{
|
||||
@@ -316,6 +338,12 @@ export const VehicleProvider = ({ children }) => {
|
||||
getVersionLog,
|
||||
uploadConfig,
|
||||
addTags,
|
||||
flashpacks,
|
||||
totalFlashpacks,
|
||||
getAllFlashpacks,
|
||||
// getFlashpackECUMappings,
|
||||
// addFlashpackECUMapping,
|
||||
// deleteFlashpackECUMapping,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
|
||||
Reference in New Issue
Block a user