CEC-2601 (#204)
This commit is contained in:
@@ -22,6 +22,10 @@ const updatesAPI = {
|
||||
getCarUpdateProgress: async (carupdateids, token) => {
|
||||
return { statuses: [] };
|
||||
},
|
||||
|
||||
cancelCarUpdate: async (id, token) => {
|
||||
return { message: "OK" };
|
||||
},
|
||||
};
|
||||
|
||||
export default updatesAPI;
|
||||
|
||||
@@ -8,17 +8,18 @@ import {
|
||||
const API_ENDPOINT = process.env.REACT_APP_UPLOAD_SERVICE_URL;
|
||||
|
||||
const createDeployUpdatesClosure = (suffix) => {
|
||||
return async (data, token) => fetch(`${API_ENDPOINT}/${suffix}`, {
|
||||
method: "POST",
|
||||
headers: Object.assign(
|
||||
{ "Content-Type": "application/json" },
|
||||
getAuthHeaderOptions(token)
|
||||
),
|
||||
body: JSON.stringify(data),
|
||||
})
|
||||
.then(fetchRespHandler)
|
||||
.catch(errorHandler)
|
||||
}
|
||||
return async (data, token) =>
|
||||
fetch(`${API_ENDPOINT}/${suffix}`, {
|
||||
method: "POST",
|
||||
headers: Object.assign(
|
||||
{ "Content-Type": "application/json" },
|
||||
getAuthHeaderOptions(token)
|
||||
),
|
||||
body: JSON.stringify(data),
|
||||
})
|
||||
.then(fetchRespHandler)
|
||||
.catch(errorHandler);
|
||||
};
|
||||
|
||||
const updatesAPI = {
|
||||
createFleetUpdates: createDeployUpdatesClosure("fleetupdate"),
|
||||
@@ -76,6 +77,18 @@ const updatesAPI = {
|
||||
.then(fetchRespHandler)
|
||||
.catch(errorHandler);
|
||||
},
|
||||
|
||||
cancelCarUpdate: async (id, token) => {
|
||||
return fetch(`${API_ENDPOINT}/carupdate/${id}/cancel`, {
|
||||
method: "POST",
|
||||
headers: Object.assign(
|
||||
{ "Content-Type": "application/json" },
|
||||
getAuthHeaderOptions(token)
|
||||
),
|
||||
})
|
||||
.then(fetchRespHandler)
|
||||
.catch(errorHandler);
|
||||
},
|
||||
};
|
||||
|
||||
export default updatesAPI;
|
||||
|
||||
Reference in New Issue
Block a user