Merge CEC-394 Car update log (#82)
This commit is contained in:
@@ -51,8 +51,11 @@ export const CarUpdatesProvider = ({ children }) => {
|
||||
result = await api.getCarUpdates(search, token);
|
||||
if (result.error)
|
||||
throw new Error(`Get car updates error. ${result.message}`);
|
||||
result.data.forEach((item) => (item.progress = 0));
|
||||
console.log(result.data);
|
||||
result.data.forEach((item) => {
|
||||
item.progress = 0;
|
||||
item.msg = item.status;
|
||||
applyProgressStatus(item, item);
|
||||
});
|
||||
setCarUpdates(result.data);
|
||||
if (search && search.offset === 0 && result.total) {
|
||||
setTotalCarUpdates(result.total);
|
||||
@@ -179,6 +182,21 @@ export const CarUpdatesProvider = ({ children }) => {
|
||||
progressTimer = 0;
|
||||
};
|
||||
|
||||
const getLog = async (query, token) => {
|
||||
let result;
|
||||
|
||||
try {
|
||||
setBusy(true);
|
||||
result = await api.getCarUpdateLog(query, token);
|
||||
if (result.error)
|
||||
throw new Error(`Get car update log error. ${result.message}`);
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
return (
|
||||
<CarUpdatesContext.Provider
|
||||
value={{
|
||||
@@ -187,6 +205,7 @@ export const CarUpdatesProvider = ({ children }) => {
|
||||
totalCarUpdates,
|
||||
deployCarUpdates,
|
||||
getCarUpdates,
|
||||
getLog,
|
||||
getVINUpdates,
|
||||
startMonitor,
|
||||
stopMonitor,
|
||||
|
||||
Reference in New Issue
Block a user