improved error loggin and updated imports to fix build failure
This commit is contained in:
+2
-10
@@ -149,17 +149,9 @@ export const createContainer = async (containerName) => {
|
||||
.then((data) => {
|
||||
return data;
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("has error", err);
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
|
||||
//console.log(
|
||||
// "\n//////////////////\n container name :",
|
||||
// containerName,
|
||||
// "\n//////////////////\n"
|
||||
// );
|
||||
|
||||
console.log(createContainerResponse);
|
||||
return createContainerResponse;
|
||||
};
|
||||
|
||||
|
||||
+54
-38
@@ -39,6 +39,7 @@ export const getIP = (req) => {
|
||||
};
|
||||
|
||||
export const consoleLogger = (err) => {
|
||||
//console.log(err);
|
||||
var errStr =
|
||||
"\n\n/////////////////////////////////////////////////\nServer Error " +
|
||||
"\n" +
|
||||
@@ -72,8 +73,11 @@ export const consoleLogger = (err) => {
|
||||
(_.has(err, "config.url")
|
||||
? "\nAxios message url: " + err.message + "\n"
|
||||
: "") +
|
||||
(_.has(err, "config.data")
|
||||
? "\nRequest payload: " + err.config.data + "\n"
|
||||
: "") +
|
||||
"\n/////////////////////////////////////////////////\n\n";
|
||||
return errStr;
|
||||
console.log(errStr);
|
||||
};
|
||||
|
||||
export const conLog = (err) => {
|
||||
@@ -212,7 +216,7 @@ export const getBasicSearch = (searchString) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
//console.log(error);
|
||||
consoleLogger(error);
|
||||
return error.response;
|
||||
});
|
||||
};
|
||||
@@ -228,7 +232,7 @@ export const getIncidentbyID = (searchString) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
//console.log(error);
|
||||
consoleLogger(error);
|
||||
return error.response;
|
||||
});
|
||||
};
|
||||
@@ -242,7 +246,7 @@ export const getIsPublishedbyID = (searchString) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
//console.log(error);
|
||||
consoleLogger(error);
|
||||
return error.response;
|
||||
});
|
||||
};
|
||||
@@ -258,7 +262,7 @@ export const getPartSavedAppeal = (searchString) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
//console.log(error);
|
||||
consoleLogger(error);
|
||||
return error.response;
|
||||
});
|
||||
};
|
||||
@@ -274,7 +278,7 @@ export const getBasicDNSURLSearch = (searchString) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
//console.log(error);
|
||||
consoleLogger(error);
|
||||
return error.response;
|
||||
});
|
||||
};
|
||||
@@ -303,6 +307,7 @@ export const getAddressSearchPaged = (
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
return error.response;
|
||||
});
|
||||
};
|
||||
@@ -331,6 +336,7 @@ export const getBasicSearchPaged = (
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
return error.response;
|
||||
});
|
||||
};
|
||||
@@ -342,6 +348,7 @@ export const getDNSCoords = () => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
let ErrResponse = {
|
||||
value: [],
|
||||
errorCode: error.response.status,
|
||||
@@ -357,6 +364,7 @@ export const getDNSList = (searchString) => {
|
||||
.get(BASE_URL + "/api/endpoint/getdnslist_api")
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
return error.response;
|
||||
});
|
||||
};
|
||||
@@ -366,6 +374,7 @@ export const getBasicDNSSearch = (searchString) => {
|
||||
.get(BASE_URL + "/api/endpoint/getbasicdnssearch_api")
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
return error.response;
|
||||
});
|
||||
};
|
||||
@@ -389,6 +398,7 @@ export const getBasicDNSSearchPaged = (
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
return error.response;
|
||||
});
|
||||
};
|
||||
@@ -402,6 +412,7 @@ export const getAdvancedSearch = (searchString) => {
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
let ErrResponse = {
|
||||
value: [],
|
||||
errorCode: error.response.status,
|
||||
@@ -434,6 +445,7 @@ export const getAdvancedSearchPaged = (
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
let ErrResponse = {
|
||||
value: [],
|
||||
errorCode: error.response.status,
|
||||
@@ -594,7 +606,6 @@ export const getAppealsTypes = () => {
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
|
||||
let ErrResponse = {
|
||||
value: [],
|
||||
errorCode: error.response.status,
|
||||
@@ -610,7 +621,7 @@ export const getAppealsTypesForNewAppeal = () => {
|
||||
.get(BASE_URL + "/api/endpoint/getappealtypesfornewappeal_api")
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
//console.log(error);
|
||||
consoleLogger(error);
|
||||
let ErrResponse = {
|
||||
value: [],
|
||||
errorCode: error.response.status,
|
||||
@@ -628,6 +639,7 @@ export const getLPA = () => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
let ErrResponse = {
|
||||
value: [],
|
||||
errorCode: error.response.status,
|
||||
@@ -926,7 +938,7 @@ export const getRepsFromBlob = (containerName) => {
|
||||
// error +
|
||||
// "\n///////////////////////\n"
|
||||
// );
|
||||
console.log(consoleLogger(error));
|
||||
consoleLogger(error);
|
||||
//console.log("API call error", error);
|
||||
});
|
||||
};
|
||||
@@ -1070,9 +1082,8 @@ export const updateAccount = async (contactId, updateBody) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const createWatchedCases = (formValues) => {
|
||||
export const createWatchedCases = async (formValues) => {
|
||||
var data = formValues;
|
||||
//var queryUrl = window.apiRoot + "/api/endpoint/createwatchedcases_api";
|
||||
var queryUrl = "/api/endpoint/createwatchedcases_api";
|
||||
|
||||
var config = {
|
||||
@@ -1081,13 +1092,14 @@ export const createWatchedCases = (formValues) => {
|
||||
data: data,
|
||||
};
|
||||
|
||||
return axios(config)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
console.log("===§=§=§=§=§=§=§=§=§=", config);
|
||||
|
||||
try {
|
||||
const res = await axios(config);
|
||||
return res.data;
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const createNewCase = (
|
||||
@@ -1778,10 +1790,10 @@ export const getPortalLogin = async (emailAddress) => {
|
||||
"/api/endpoint/getportallogin_api?emailAddress=" + emailAddress;
|
||||
|
||||
return axios
|
||||
.get(BASE_URL + queryUrl)
|
||||
.get(BASE_URL + queryUrl + hashAPIPath(queryUrl))
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log(consoleLogger(error));
|
||||
consoleLogger(error);
|
||||
|
||||
return JSON.stringify(error);
|
||||
});
|
||||
@@ -1797,7 +1809,7 @@ export const createContainerProxy = (containerName) => {
|
||||
.get(BASE_URL + queryUrl)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log(consoleLogger(error));
|
||||
consoleLogger(error);
|
||||
|
||||
return JSON.stringify(error);
|
||||
});
|
||||
@@ -1886,21 +1898,25 @@ export const getAddressSearch = async (searchString) => {
|
||||
const params = new URLSearchParams(searchString);
|
||||
const str = params.toString();
|
||||
|
||||
//console.log(
|
||||
// "the url",
|
||||
// BASE_URL + "/api/endpoint/getbasicsearch_by_address_api?" + str
|
||||
// );
|
||||
try {
|
||||
const res = await axios.get(
|
||||
BASE_URL + "/api/endpoint/getbasicsearch_by_address_api?" + str
|
||||
);
|
||||
return res.data;
|
||||
} catch (error) {
|
||||
let ErrResponse = {
|
||||
value: [],
|
||||
errorCode: error.response.status,
|
||||
errorMsg: error.response.statusText,
|
||||
};
|
||||
return ErrResponse;
|
||||
}
|
||||
var queryUrl =
|
||||
BASE_URL + "/api/endpoint/getbasicsearch_by_address_api?" + str;
|
||||
|
||||
var config = {
|
||||
method: "get",
|
||||
url: queryUrl,
|
||||
};
|
||||
|
||||
return axios(config)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
let ErrResponse = {
|
||||
value: [],
|
||||
errorCode: error.response.status,
|
||||
errorMsg: error.response.statusText,
|
||||
};
|
||||
return ErrResponse;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@ export default function Inspectorate() {
|
||||
return (
|
||||
<div className="card clear" id="inspectorate-card">
|
||||
<div className="card-body">
|
||||
<img
|
||||
<Image
|
||||
alt={t("home:inspectorate-card-alt-text")}
|
||||
src="/assets/images/PINS_dual_logo_400.png"
|
||||
width="380px"
|
||||
|
||||
@@ -121,9 +121,9 @@ const TopThree = (props) => {
|
||||
setMyRepresentations(data);
|
||||
setMyRepresentationsDetails(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
consoleLogger(err);
|
||||
res.status(400).json(err);
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
res.status(400).json(error);
|
||||
})
|
||||
.then(() => {
|
||||
setCurrentView({
|
||||
|
||||
@@ -778,9 +778,9 @@ const ViewAllResults = (props) => {
|
||||
setMyRepresentations(data);
|
||||
setMyRepresentationsDetails(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
consoleLogger(err);
|
||||
res.status(400).json(err);
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
res.status(400).json(error);
|
||||
})
|
||||
.then(() => {
|
||||
setCurrentView({
|
||||
|
||||
@@ -460,7 +460,6 @@ let AboutYou = (props) => {
|
||||
|
||||
const onHandleSubmit = (values) => {
|
||||
event.preventDefault();
|
||||
console.log(JSON.stringify(values));
|
||||
window.scrollTo({ top: 0, behavior: "smooth" });
|
||||
setFormStep(1);
|
||||
};
|
||||
|
||||
@@ -460,8 +460,8 @@ let CreateCase = (props) => {
|
||||
);
|
||||
return data;
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(consoleLogger(err));
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
|
||||
// router.replace(
|
||||
|
||||
@@ -257,11 +257,11 @@ const SearchResults = (props) => {
|
||||
href={
|
||||
(router.locale == "cy"
|
||||
? myportal == true
|
||||
? "/fymhorth/achos/id"
|
||||
: "/achos/id"
|
||||
? "/fymhorth/achos"
|
||||
: "/achos"
|
||||
: myportal == true
|
||||
? "/myportal/case/"
|
||||
: "/case/") +
|
||||
? "/myportal/case"
|
||||
: "/case") +
|
||||
"/" +
|
||||
item.pinswg_name
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
},
|
||||
}),
|
||||
],
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
},
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -169,8 +169,6 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
await getWatchedCases(loggedInUser),
|
||||
]);
|
||||
|
||||
console.log(accountDetails);
|
||||
|
||||
const [searchDetailsObj, watchedCasesDetails] = await Promise.all([
|
||||
await getSearchDetails(searchResultsObj),
|
||||
await getDetails(watchedCases, "myWatchedCases"),
|
||||
|
||||
Reference in New Issue
Block a user