Files
ota-admin-portal/src/services/issueAPI.js
John Wu b80a2cb8bf Release/0.0.3 to main (#254)
* CEC-2628 - Display IP in digital twin in portal (#251)

* CEC-3453 Update security dll instructions (#252)

* CEC-2752-Add-Mobile-Issue-Tracker (#250)

* 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>

* Cec 2752 small fix (#253)

* 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

* small fix

Co-authored-by: jwu-fisker <jwu@fiskerinc.com>

Co-authored-by: Paul Adamsen <117673433+pauladamseniii@users.noreply.github.com>
Co-authored-by: das31 <31259710+das31@users.noreply.github.com>
2023-01-10 18:30:39 -08:00

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;