backend: Small Hotfix
This commit is contained in:
parent
a2b5a02f6b
commit
b0ce56a035
@ -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();
|
||||
|
@ -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);
|
||||
}
|
Reference in New Issue
Block a user