delete working

This commit is contained in:
padamsen_fisker
2024-01-12 16:36:28 -05:00
parent 437ec9e124
commit 43d1721804
5 changed files with 100 additions and 9 deletions

View File

@@ -304,11 +304,11 @@ export const VehicleProvider = ({ children }) => {
if (options && options.offset === 0 && result.total) {
setTotalFlashpacks(result.total);
}
return result;
} finally {
setBusy(false);
}
return result;
};
const getFlashpackECUMappings = async (model, year, flashpack, options, token) => {
@@ -324,11 +324,33 @@ export const VehicleProvider = ({ children }) => {
if (options && options.offset === 0 && result.total) {
setTotalFlashpackECUMappings(result.total);
}
return result;
} finally {
setBusy(false);
}
};
const deleteFlashpackVersion = async (model, year, flashpack, token) => {
let result;
try {
setBusy(true);
const data = {
"car_model": model,
"car_year": year,
"flashpack": flashpack,
}
result = await api.deleteFlashpackVersion(data, token);
if (result.error)
throw new Error(`Delete flashpack ecu mappings error. ${result.message}`);
return result;
} finally {
setBusy(false);
}
return result;
};
return (
@@ -366,6 +388,7 @@ export const VehicleProvider = ({ children }) => {
totalFlashpackECUMappings,
flashpackECUMappings,
getFlashpackECUMappings,
deleteFlashpackVersion,
}}
>
{children}