TASK22102: slice4 larger file set + production detail suppression
This commit is contained in:
@@ -15,6 +15,7 @@ import CryptoJS from "crypto-js";
|
||||
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 ||
|
||||
@@ -28,7 +29,11 @@ export default async function ApiProxy(req, res) {
|
||||
typeof req.body.incidentid === "undefined" ||
|
||||
req.body.incidentid.length === 0
|
||||
) {
|
||||
return res.status(400).json();
|
||||
return respondError(res, {
|
||||
status: 400,
|
||||
code: "MISSING_REQUIRED_BODY",
|
||||
message: "contactid and incidentid are required"
|
||||
});
|
||||
}
|
||||
|
||||
var token = await getToken();
|
||||
@@ -63,12 +68,16 @@ export default async function ApiProxy(req, res) {
|
||||
|
||||
return axios(config)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
return respondSuccess(res, data);
|
||||
})
|
||||
.catch((error) => {
|
||||
return error.status == 412
|
||||
? res.status(200).json({ "record": "exists" })
|
||||
? respondSuccess(res, { "record": "exists" })
|
||||
: (consoleLogger(Object.assign(error, data)),
|
||||
res.status(400).json(error));
|
||||
respondError(res, {
|
||||
status: 400,
|
||||
code: "CREATE_REP_INVOLVEMENT_FAILED",
|
||||
message: "Failed to create representation involvement"
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user