update proxy for get - update appeal record data
This commit is contained in:
@@ -72,6 +72,20 @@ export default async function ApiProxy(req, res) {
|
||||
|
||||
// console.log(SASToken);
|
||||
|
||||
var configNoData = {
|
||||
method: req.method,
|
||||
//url: WEBAPI_URL + updateFormCollection + "(" + incidentId + ")",
|
||||
url: WEBAPI_URL + req.url.split("/api/proxy/")[1],
|
||||
headers: {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Authorization": SASToken,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
};
|
||||
|
||||
var config = {
|
||||
method: req.method,
|
||||
//url: WEBAPI_URL + updateFormCollection + "(" + incidentId + ")",
|
||||
@@ -87,17 +101,17 @@ export default async function ApiProxy(req, res) {
|
||||
data: data,
|
||||
};
|
||||
|
||||
console.log(config);
|
||||
console.log(req.url.split("/api/proxy/")[1]);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
// console.log(config);
|
||||
axios(config)
|
||||
axios(req.method == "GET" ? configNoData : config)
|
||||
.then((response) => {
|
||||
res.statusCode = 200;
|
||||
res.setHeader("Content-Type", "application/json");
|
||||
res.setHeader("Cache-Control", "max-age=1800000");
|
||||
res.end(JSON.stringify(response.data));
|
||||
console.log("response data", response.data);
|
||||
// console.log("response data", response.data);
|
||||
resolve();
|
||||
})
|
||||
.catch((error) => {
|
||||
|
||||
Reference in New Issue
Block a user