error handling logging and debug to server console

This commit is contained in:
2022-07-19 11:51:16 +01:00
parent be9f86b6b2
commit 31738d38fa
61 changed files with 372 additions and 155 deletions
+4 -2
View File
@@ -1,7 +1,7 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import _ from "lodash";
import { getToken, azureHeadersPaged } from "../../../actions";
import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
@@ -44,9 +44,11 @@ export default async function ApiProxy(req, res) {
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
console.log(data);
res.status(200).json(data);
})
.catch(({ err }) => {
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
})
: res.status(400).json();