improved error loggin and updated imports to fix build failure

This commit is contained in:
2024-06-19 15:06:28 +01:00
parent d01179c724
commit be99db0774
78 changed files with 319 additions and 325 deletions
+2 -2
View File
@@ -62,7 +62,7 @@ const prisma = new PrismaClient();
// // emailReplyToId: emailReplyToId,
// })
// //.then((response) => console.log(response))
// .catch((err) => consoleLogger(err));
// .catch((error) => consoleLogger(err));
// },
// }),
// ],
@@ -201,7 +201,7 @@ const authOptions = (locale, req, res) => {
}
)
//.then((response) => console.log(response))
.catch((err) => consoleLogger(err));
.catch((error) => consoleLogger(err));
},
}),
],
+3 -3
View File
@@ -103,8 +103,8 @@ export default async function ApiProxy(req, res) {
return "downloadComplete";
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
+3 -3
View File
@@ -47,9 +47,9 @@ export default async function ApiProxy(req, res) {
//console.log("thisis the response", response);
return res.status(200).json(data);
})
.catch((err) => {
consoleLogger(err);
return res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
return res.status(400).json(error);
});
//return res.status(200).json(data);
}
+3 -3
View File
@@ -55,8 +55,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
+3 -3
View File
@@ -109,9 +109,9 @@ export default async function ApiProxy(req, res) {
res.status(200).json(data);
})
.catch((err) => {
//console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
//consoleLogger(error);
res.status(400).json(error);
});
return apiResponse;
+4 -11
View File
@@ -37,8 +37,6 @@ export default async function ApiProxy(req, res) {
var data = JSON.stringify(req.body);
var queryUrl = "pinswg_watchlists";
console.log(data);
var config = {
method: "post",
url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
@@ -46,24 +44,19 @@ export default async function ApiProxy(req, res) {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json",
"Prefer": 'odata.include-annotations="*"',
"Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json",
},
data: data,
};
console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
console.log(data);
return axios(config)
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
console.log(data);
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(Object.assign(err, data));
res.status(400).json(error);
});
}
@@ -44,7 +44,7 @@ export default async function ApiProxy(req, res) {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json",
"Prefer": 'odata.include-annotations="*"',
"Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json",
},
@@ -52,11 +52,10 @@ export default async function ApiProxy(req, res) {
return axios(config)
.then(({ data }) => {
//console.log("deleted awaitingsubmission case - " + incidentID);
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
@@ -44,7 +44,7 @@ export default async function ApiProxy(req, res) {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json",
"Prefer": 'odata.include-annotations="*"',
"Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json",
},
@@ -54,8 +54,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
+4 -4
View File
@@ -46,7 +46,7 @@ export default async function ApiProxy(req, res) {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json",
"Prefer": 'odata.include-annotations="*"',
"Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json",
},
@@ -57,8 +57,8 @@ export default async function ApiProxy(req, res) {
//console.log("deleted watched case - " + watchedCaseID);
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
+3 -3
View File
@@ -102,9 +102,9 @@ export default async function ApiProxy(req, res) {
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
return apiResponse;
@@ -146,9 +146,9 @@ export default async function ApiProxy(req, res) {
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
return apiResponse;
+3 -3
View File
@@ -69,8 +69,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
+3 -3
View File
@@ -49,8 +49,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
@@ -57,8 +57,8 @@ export default async function ApiProxy(req, res) {
});
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
@@ -50,8 +50,8 @@ export default async function ApiProxy(req, res) {
});
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
+3 -3
View File
@@ -59,8 +59,8 @@ export default async function ApiProxy(req, res) {
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
@@ -57,9 +57,9 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
})
: res.status(400).json();
@@ -60,9 +60,9 @@ export default async function ApiProxy(req, res) {
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
return res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
})
: res.status(400).json();
@@ -95,8 +95,8 @@ export default async function ApiProxy(req, res) {
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
return res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
@@ -69,9 +69,9 @@ export default async function ApiProxy(req, res) {
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
})
: res.status(400).json();
@@ -43,8 +43,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
+7 -9
View File
@@ -53,12 +53,10 @@ export default async function ApiProxy(req, res) {
console.log(
"\n==========================================\n",
"basic search: " + queryUrl,
"\n\n",
"basic search relay link: " +
WEBAPI_URL +
queryUrl +
hashAPIPath(queryUrl),
"\nBasic search ",
"\nSearch String: " + searchString,
"\n\nQuery url: " + queryUrl,
"\n\nRelay link: " + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
"\n==========================================\n"
);
@@ -77,9 +75,9 @@ export default async function ApiProxy(req, res) {
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
})
: res.status(400).json();
@@ -460,9 +460,9 @@ export default async function ApiProxy(req, res) {
});
return searchResultsObj.push(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
return resultObj;
@@ -479,9 +479,9 @@ export default async function ApiProxy(req, res) {
});
return searchResultsObj.push(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
return resultObj;
@@ -517,13 +517,6 @@ export default async function ApiProxy(req, res) {
})
);
console.log(
"===========n\n appellant name:",
appellantname,
addressline1,
county
);
if (req.query.hasOwnProperty("appellantname")) {
searchResultsObj = searchResultsObj.filter(
(arr) =>
@@ -68,10 +68,10 @@ export default async function ApiProxy(req, res) {
console.log(
"\n==========================================\n",
"\ndetails query: ",
queryUrl,
"\n\n",
"<<<<end query",
"\nSearch Details query ",
"\nAppealType: " + appealTypeName,
"\nIncident ID: " + incidentID,
"\n\nQuery url: " + queryUrl,
"\n==========================================\n"
);
@@ -83,8 +83,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
@@ -84,8 +84,8 @@ export default async function ApiProxy(req, res) {
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
return res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
@@ -112,9 +112,9 @@ export default async function ApiProxy(req, res) {
dataStr.split("/v8.2/")[1]));
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
})
: res.status(400).json();
+3 -3
View File
@@ -55,8 +55,8 @@ export default async function ApiProxy(req, res) {
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data);
})
.catch((err) => {
consoleLogger(err);
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
+3 -3
View File
@@ -36,8 +36,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
+3 -3
View File
@@ -41,8 +41,8 @@ export default async function ApiProxy(req, res) {
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
@@ -55,9 +55,9 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
})
: res.status(400).json();
+3 -3
View File
@@ -37,8 +37,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
+3 -3
View File
@@ -69,9 +69,9 @@ export default async function ApiProxy(req, res) {
//);
return res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
})
: res.status(400).json();
+3 -3
View File
@@ -67,8 +67,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
+3 -3
View File
@@ -55,8 +55,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
+3 -3
View File
@@ -70,9 +70,9 @@ export default async function ApiProxy(req, res) {
console.log(data);
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
})
: res.status(400).json();
+3 -3
View File
@@ -49,8 +49,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
+3 -3
View File
@@ -61,8 +61,8 @@ export default async function ApiProxy(req, res) {
});
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
+3 -3
View File
@@ -76,8 +76,8 @@ export default async function ApiProxy(req, res) {
});
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
@@ -55,8 +55,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
@@ -53,8 +53,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
+3 -3
View File
@@ -56,9 +56,9 @@ export default async function ApiProxy(req, res) {
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
})
: res.status(400).json();
+31 -19
View File
@@ -39,31 +39,43 @@ const hashAPIPath = (queryPath) => {
export default async function ApiProxy(req, res) {
var emailAddress = req.query.emailAddress;
var token = await getToken();
var checkHash = req.query.hash;
var checkquerypath =
"/api/endpoint/getportallogin_api?emailAddress=" + emailAddress;
// console.log("-----", casefolderID);
// console.log("-----", req.query);
// console.log("-----", checkquerypath);
// console.log("-----", hashAPIPath(checkquerypath));
// console.log("-----", checkHash);
// console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash);
var queryUrl =
"contacts?$filter=emailaddress1 eq '" +
emailAddress +
"' and statuscode eq 1&$count=true&$select=emailaddress1,contactid,yomifullname,firstname,lastname";
console.log(req.query, queryUrl);
var apiResponse = _.isEmpty(req.query)
? res.status(400).json()
: typeof emailAddress != "undefined" && emailAddress.length > 0
? axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
//console.log(data);
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
})
: res.status(400).json();
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
var apiResponse = _.isEmpty(req.query)
? res.status(400).json()
: typeof emailAddress != "undefined" && emailAddress.length > 0
? axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
//console.log(data);
res.status(200).json(data);
})
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
})
: res.status(400).json();
} else {
return res.status(400).json();
}
return apiResponse;
}
@@ -59,9 +59,9 @@ export default async function ApiProxy(req, res) {
//console.log(data);
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
})
: res.status(400).json();
@@ -68,8 +68,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
@@ -64,8 +64,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
+3 -3
View File
@@ -54,8 +54,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
@@ -53,8 +53,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
@@ -91,8 +91,8 @@ export default async function ApiProxy(req, res) {
// (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(dataArr);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
@@ -80,8 +80,8 @@ export default async function ApiProxy(req, res) {
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
@@ -130,8 +130,8 @@ export default async function ApiProxy(req, res) {
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
return res.status(200).json(data);
})
.catch((err) => {
consoleLogger(err);
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
@@ -54,8 +54,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
@@ -85,8 +85,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
+3 -3
View File
@@ -79,8 +79,8 @@ export default async function ApiProxy(req, res) {
});
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
@@ -53,8 +53,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
+3 -3
View File
@@ -64,9 +64,9 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
return apiResponse;
+4 -4
View File
@@ -45,7 +45,7 @@ export default async function ApiProxy(req, res) {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json",
"Prefer": 'odata.include-annotations="*"',
"Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json",
},
@@ -58,8 +58,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
+1 -1
View File
@@ -49,7 +49,7 @@ export default async function ApiProxy(req, res) {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json",
"Prefer": 'odata.include-annotations="*"',
"Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json",
},
+4 -4
View File
@@ -45,7 +45,7 @@ export default async function ApiProxy(req, res) {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json",
"Prefer": 'odata.include-annotations="*"',
"Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json",
},
@@ -56,8 +56,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
@@ -45,9 +45,9 @@ ApiProxy.get(async (req, res) => {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
});
+3 -3
View File
@@ -246,8 +246,8 @@ export default async function handler(req, res) {
path: `${caseRef}/${reqBodyobj.repfile_name}/files/${reqBodyobj.repfile_name}.pdf`,
});
})
.catch((err) => {
consoleLogger(err);
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
@@ -38,8 +38,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
consoleLogger(err);
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
+7 -3
View File
@@ -49,15 +49,19 @@ ApiProxy.get(async (req, res) => {
"&casefolderID=" +
casefolderID;
//console.log(hashAPIPath(checkquerypath), checkHash);
//console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash);
// console.log("-----", casefolderID);
// console.log("-----", req.query);
// console.log("-----", checkquerypath);
// console.log("-----", hashAPIPath(checkquerypath));
// console.log("-----", checkHash);
// console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash);
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
await getBlobs(containerName, casefolderID).then((data) => {
return res.status(200).json({ "value": [data] });
});
} else {
return res.status(400).json({ "error": "ooops" });
return res.status(400).json();
}
});
+6 -2
View File
@@ -21,8 +21,12 @@ ApiProxy.get(async (req, res) => {
"&casefolderID=" +
casefolderID;
//console.log(hashAPIPath(checkquerypath), checkHash);
//console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash);
// console.log("-----", casefolderID);
// console.log("-----", req.query);
// console.log("-----", checkquerypath);
// console.log("-----", hashAPIPath(checkquerypath));
// console.log("-----", checkHash);
// console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash);
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
const blobObj = await getProgressBlobs(containerName, casefolderID)
+2 -15
View File
@@ -58,15 +58,9 @@ ApiProxy.get(async (req, res) => {
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
const blobObj = await getRepsBlobs(containerName, casefolderID)
.then(async (data) => {
//console.log(
// "\n////////////////////////////\n getRepsBlobs:",
// data
// );
return data;
})
.then(async (data) => {
//console.log("\n////////////////////////////\n now here:", data);
let result = await downloadAllRepsFiles(containerName, data);
return res
@@ -75,17 +69,10 @@ ApiProxy.get(async (req, res) => {
.json(result);
})
.catch((error) => {
//console.log(
// "///////////////////////\ngetRepsFromBlob api in api route response: " +
// error +
// "\n///////////////////////\n"
// );
//console.log("API call error", error);
console.log(consoleLogger(error));
consoleLogger(error);
});
} else {
return res.status(400).json({ msg: "error" });
return res.status(400).json();
}
});
+3 -3
View File
@@ -37,8 +37,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
consoleLogger(err);
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
+3 -5
View File
@@ -23,13 +23,11 @@ ApiProxy.get(async (req, res) => {
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
await createContainer(containerName)
.then((data) => {
//console.log("has response:", data);
return res.status(200).json({ data: "success" });
})
.catch((err) => {
console.log(err);
console.log(consoleLogger(err));
res.status(400).json(err);
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
} else {
return res.status(400).json();
+3 -2
View File
@@ -37,7 +37,7 @@ export default async function ApiProxy(req, res) {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json",
"Prefer": 'odata.include-annotations="*"',
"Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json",
},
@@ -51,6 +51,7 @@ export default async function ApiProxy(req, res) {
res.status(200).json(data);
})
.catch((error) => {
res.status(400);
consoleLogger(error);
res.status(400).json(error);
});
}