backend: Small Hotfix

This commit is contained in:
Divlo 2020-03-19 23:21:20 +01:00
parent a2b5a02f6b
commit b0ce56a035
2 changed files with 4 additions and 1 deletions

View File

@ -20,6 +20,9 @@ exports.convertCurrencyOutput = ({ res, next }, argsObject) => {
axios.get(`https://api.exchangeratesapi.io/latest?base=${baseCurrency}`)
.then((response) => {
const rate = response.data.rates[finalCurrency];
if (!rate) {
return errorHandling(next, { message: "La devise n'existe pas.", statusCode: 404 });
}
const result = rate * number;
const dateObject = new Date(response.data.date);
const year = dateObject.getFullYear();

View File

@ -48,5 +48,5 @@ exports.convertTemperatureOutput = ({ res, next }, argsObject) => {
return errorHandling(next, generalError);
}
return res.status(200).json({ result });
return res.status(200).json(result);
}