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);
|
const [delayCount, setDelayCount] = useState(0);
|
||||||
let progressTimer = 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) => {
|
const deployCarUpdates = async (data, token) => {
|
||||||
let result;
|
let result;
|
||||||
|
|
||||||
@@ -228,6 +243,7 @@ export const CarUpdatesProvider = ({ children }) => {
|
|||||||
busy,
|
busy,
|
||||||
carUpdates,
|
carUpdates,
|
||||||
totalCarUpdates,
|
totalCarUpdates,
|
||||||
|
cancelUpdate,
|
||||||
deployCarUpdates,
|
deployCarUpdates,
|
||||||
deployFleetUpdates,
|
deployFleetUpdates,
|
||||||
getCarUpdates,
|
getCarUpdates,
|
||||||
|
|||||||
Reference in New Issue
Block a user