TASK22102: slice3 migrate file proxy handlers
This commit is contained in:
@@ -3,6 +3,7 @@ import { getToken } from "../../../actions/core/token";
|
||||
import { azureHeaders } from "../../../actions/core/headers";
|
||||
import { consoleLogger } from "../../../actions/core/logger";
|
||||
import axios from "axios";
|
||||
import { respondError, respondSuccess } from "../middleware/apiResponse";
|
||||
|
||||
import nextConnect from "next-connect";
|
||||
import middleware from "../middleware/middleware";
|
||||
@@ -20,7 +21,11 @@ ApiProxy.get(async (req, res) => {
|
||||
var tempCaseRef = req.query.tempcaseref;
|
||||
|
||||
if (!hasValue(containerName) || !hasValue(tempCaseRef)) {
|
||||
return res.status(400).json();
|
||||
return respondError(res, {
|
||||
status: 400,
|
||||
code: "MISSING_REQUIRED_QUERY",
|
||||
message: "container and tempcaseref are required"
|
||||
});
|
||||
}
|
||||
|
||||
var token = await getToken();
|
||||
@@ -37,11 +42,15 @@ ApiProxy.get(async (req, res) => {
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
return respondSuccess(res, data);
|
||||
})
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
res.status(400).json(error);
|
||||
return respondError(res, {
|
||||
status: 400,
|
||||
code: "CREATE_APPEAL_COMPLETE_MESSAGE_PROXY_FAILED",
|
||||
message: "Failed to create appeal complete message"
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user