Merge development (#86)
This commit is contained in:
30
src/services/manifestsAPI.js
Normal file
30
src/services/manifestsAPI.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import { getAuthHeaderOptions, fetchRespHandler, addQueryParams } from "../utils/http";
|
||||
|
||||
const API_ENDPOINT = process.env.REACT_APP_UPLOAD_SERVICE_URL || "https://gw-dev.fiskerdps.com/ota_update";
|
||||
|
||||
const manifestsAPI = {
|
||||
deleteManifest: async (manifest_id, token) => fetch(`${API_ENDPOINT}/manifest?id=${manifest_id}`, {
|
||||
method: "DELETE",
|
||||
headers: Object.assign({ "Content-Type": "application/json" }, getAuthHeaderOptions(token)),
|
||||
})
|
||||
.then(fetchRespHandler),
|
||||
|
||||
getManifests: async (search, token) => {
|
||||
const u = addQueryParams(`${API_ENDPOINT}/manifests`, search);
|
||||
return fetch(u, {
|
||||
method: "GET",
|
||||
headers: Object.assign({ "Content-Type": "application/json" }, getAuthHeaderOptions(token)),
|
||||
|
||||
})
|
||||
.then(fetchRespHandler);
|
||||
},
|
||||
|
||||
createManifest: async (data, token) => fetch(`${API_ENDPOINT}/manifest`, {
|
||||
method: "POST",
|
||||
headers: Object.assign({ "Content-Type": "application/json" }, getAuthHeaderOptions(token)),
|
||||
body: JSON.stringify(data),
|
||||
})
|
||||
.then(fetchRespHandler),
|
||||
};
|
||||
|
||||
export default manifestsAPI;
|
||||
Reference in New Issue
Block a user