refactor(api): migrate batch 12 remaining relay-get candidates
This commit is contained in:
@@ -1,14 +1,8 @@
|
||||
import axios from "axios";
|
||||
import { JSONPath as jsonpath } from "jsonpath-plus";
|
||||
import { azureHeaders } from "../../../actions/core/headers";
|
||||
import { consoleLogger } from "../../../actions/core/logger";
|
||||
import { getToken } from "../../../actions/core/token";
|
||||
import { hashAPIPath } from "../../../actions/core/hash";
|
||||
import { respondError, respondSuccess } from "../middleware/apiResponse";
|
||||
|
||||
const WEBAPI_URL =
|
||||
process.env.RELAY_ROOT ||
|
||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
import { relayGetData } from "../middleware/relayForwarding";
|
||||
|
||||
const escapeODataString = (value = "") =>
|
||||
String(value).replace(/'/g, "''").trim();
|
||||
@@ -366,15 +360,15 @@ const fetchSearchResultsForAppealType = async (item, token, params) => {
|
||||
"\n\n",
|
||||
item.LogicalCollectionName,
|
||||
"\n\n",
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
queryUrl,
|
||||
"\n==========================================\n"
|
||||
);
|
||||
|
||||
try {
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
);
|
||||
const { data } = await relayGetData({
|
||||
queryUrl,
|
||||
accessToken: token.access_token
|
||||
});
|
||||
|
||||
return (data.value || []).map((record) => ({
|
||||
...record,
|
||||
@@ -391,10 +385,10 @@ const fetchIncident = async (incidentId, token) => {
|
||||
const queryUrl = buildIncidentQueryUrl(incidentId);
|
||||
|
||||
try {
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
);
|
||||
const { data } = await relayGetData({
|
||||
queryUrl,
|
||||
accessToken: token.access_token
|
||||
});
|
||||
|
||||
return data?.value?.[0] || null;
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user