CEC-2601 Fix cancel update handler (#211)
This commit is contained in:
@@ -36,6 +36,21 @@ export const CarUpdatesProvider = ({ children }) => {
|
||||
const [delayCount, setDelayCount] = useState(0);
|
||||
let progressTimer = 0;
|
||||
|
||||
const cancelUpdate = async (id, token) => {
|
||||
let result;
|
||||
|
||||
try {
|
||||
setBusy(true);
|
||||
result = await api.cancelCarUpdate(id, token);
|
||||
if (result.error)
|
||||
throw new Error(`Cancel car update error. ${result.message}`);
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
const deployCarUpdates = async (data, token) => {
|
||||
let result;
|
||||
|
||||
@@ -228,6 +243,7 @@ export const CarUpdatesProvider = ({ children }) => {
|
||||
busy,
|
||||
carUpdates,
|
||||
totalCarUpdates,
|
||||
cancelUpdate,
|
||||
deployCarUpdates,
|
||||
deployFleetUpdates,
|
||||
getCarUpdates,
|
||||
|
||||
Reference in New Issue
Block a user