* first commit * removed comments * remove more comments * fix build issues * fix unused vars * update snapshot * fix test * Fix connect ECONNREFUSED 127.0.0.1:80 * Test Magna side menu * attempt to pass test * fix test * remove comments * fix some code smells * fix test * resolve comments * fix bug * resolved comments * resolve comments * resolve comments * update snapshot * resolved comments Co-authored-by: jwu-fisker <jwu@fiskerinc.com>
46 lines
1.1 KiB
JavaScript
46 lines
1.1 KiB
JavaScript
import {
|
|
addQueryParams, errorHandler, fetchRespHandler, getAuthHeaderOptions
|
|
} from "../utils/http";
|
|
|
|
const API_ENDPOINT = process.env.REACT_APP_OTA_SERVICE_URL;
|
|
|
|
const issuesAPI = {
|
|
deleteIssue: async (id, token) =>
|
|
fetch(`${API_ENDPOINT}/issues/${id}`, {
|
|
method: "DELETE",
|
|
headers: Object.assign(
|
|
{ "Content-Type": "application/json" },
|
|
getAuthHeaderOptions(token)
|
|
),
|
|
})
|
|
.then(fetchRespHandler)
|
|
.catch(errorHandler),
|
|
|
|
getIssue: async (id, token) =>
|
|
fetch(`${API_ENDPOINT}/issues/${id}`, {
|
|
method: "GET",
|
|
headers: Object.assign(
|
|
{ "Content-Type": "application/json" },
|
|
getAuthHeaderOptions(token)
|
|
),
|
|
})
|
|
.then(fetchRespHandler)
|
|
.catch(errorHandler),
|
|
|
|
getIssues: async (search, token) => {
|
|
const u = addQueryParams(`${API_ENDPOINT}/issues`, search);
|
|
return fetch(u, {
|
|
method: "GET",
|
|
headers: Object.assign(
|
|
{ "Content-Type": "application/json" },
|
|
getAuthHeaderOptions(token)
|
|
),
|
|
})
|
|
.then(fetchRespHandler)
|
|
.catch(errorHandler);
|
|
},
|
|
|
|
};
|
|
|
|
export default issuesAPI;
|