further improvements

This commit is contained in:
padamsen_fisker
2023-12-08 12:27:54 -05:00
parent fc1a5f0219
commit 754c5eb746
4 changed files with 185 additions and 5 deletions

View File

@@ -309,6 +309,26 @@ export const VehicleProvider = ({ children }) => {
return result;
};
const getFlashpackECUMappings = async (flashpack, model, year, 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={{
@@ -341,7 +361,7 @@ export const VehicleProvider = ({ children }) => {
flashpacks,
totalFlashpacks,
getAllFlashpacks,
// getFlashpackECUMappings,
getFlashpackECUMappings,
// addFlashpackECUMapping,
// deleteFlashpackECUMapping,
}}