delete working
This commit is contained in:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user