CEC-5900 - Add the ability to edit Flashpack versions after they are added
This commit is contained in:
@@ -354,6 +354,26 @@ export const VehicleProvider = ({ children }) => {
|
||||
}
|
||||
}
|
||||
|
||||
const addFlashpackVersionECUMapping = async (model, trim, year, flashpack, ecuName, ecuVersion, token) => {
|
||||
try {
|
||||
setBusy(true);
|
||||
|
||||
const data = {
|
||||
"car_ecu_name": ecuName,
|
||||
"car_ecu_version": ecuVersion,
|
||||
}
|
||||
|
||||
const result = await api.addFlashpackVersionECUMapping(model, trim, year, flashpack, data, token)
|
||||
if (result.error) {
|
||||
throw new Error(`Add flashpack version ECU mapping error. ${result.message}`);
|
||||
}
|
||||
|
||||
return result;
|
||||
} finally {
|
||||
setBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
const deleteFlashpackVersion = async (model, trim, year, flashpack, token) => {
|
||||
try {
|
||||
setBusy(true);
|
||||
@@ -367,7 +387,22 @@ export const VehicleProvider = ({ children }) => {
|
||||
|
||||
const result = await api.deleteFlashpackVersion(data, token);
|
||||
if (result.error) {
|
||||
throw new Error(`Delete flashpack ecu mappings error. ${result.message}`);
|
||||
throw new Error(`Delete flashpack version error. ${result.message}`);
|
||||
}
|
||||
|
||||
return result;
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
|
||||
const deleteFlashpackVersionECUMapping = async (model, trim, year, flashpack, ecuName, ecuVersion, token) => {
|
||||
try {
|
||||
setBusy(true);
|
||||
|
||||
const result = await api.deleteFlashpackVersionECUMapping(model, trim, year, flashpack, ecuName, ecuVersion, token);
|
||||
if (result.error) {
|
||||
throw new Error(`Delete flashpack ecu mapping error. ${result.message}`);
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -427,7 +462,9 @@ export const VehicleProvider = ({ children }) => {
|
||||
flashpackECUMappings,
|
||||
getFlashpackECUMappings,
|
||||
addFlashpackVersion,
|
||||
addFlashpackVersionECUMapping,
|
||||
deleteFlashpackVersion,
|
||||
deleteFlashpackVersionECUMapping,
|
||||
getCarFlashpackVersionInfo,
|
||||
}}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user