CEC-4523: Add bulk archive support (#379)

* CEC-4523: add archive endpoint and action
This commit is contained in:
Tristan Timblin
2023-07-03 12:07:19 -04:00
committed by GitHub
parent a7c13306c5
commit 11406aa8da
8 changed files with 163 additions and 63 deletions

View File

@@ -5,6 +5,10 @@ const manifestsAPI = {
return data;
},
archiveManifest: async (data, token) => {
return { message: "Archived 1 update manifests" };
},
deleteManifest: async (manifest_id, token) => {
return { message: "OK" };
},

View File

@@ -1,10 +1,22 @@
import {
addQueryParams, errorHandler, fetchRespHandler, getAuthHeaderOptions
addQueryParams, errorHandler, fetchRespHandler, getAuthHeaderOptions
} from "../utils/http";
const API_ENDPOINT = process.env.REACT_APP_OTA_SERVICE_URL;
const manifestsAPI = {
archiveManifest: async (data, token) =>
fetch(`${API_ENDPOINT}/vehicles/archive`, {
method: "PUT",
headers: Object.assign(
{ "Content-Type": "application/json" },
getAuthHeaderOptions(token)
),
body: JSON.stringify(data)
})
.then(fetchRespHandler)
.catch(errorHandler),
deleteManifest: async (manifest_id, token) =>
fetch(`${API_ENDPOINT}/manifest?id=${manifest_id}`, {
method: "DELETE",
@@ -79,8 +91,8 @@ const manifestsAPI = {
.then(fetchRespHandler)
.catch(errorHandler),
migrateManifest: async (manifest_id, token) =>
fetch(`${API_ENDPOINT}/manifestmigrate/${manifest_id}`,{
migrateManifest: async (manifest_id, token) =>
fetch(`${API_ENDPOINT}/manifestmigrate/${manifest_id}`, {
method: "POST",
headers: Object.assign(
{ "Content-Type": "application/json" },