From 67b6cfb95f586503341696a9625514edec744606 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 7 Oct 2019 20:37:35 -0700 Subject: check for rates before setting --- rates.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/rates.js b/rates.js index d4616780..33c66ec8 100644 --- a/rates.js +++ b/rates.js @@ -13,11 +13,16 @@ module.exports = app => { let fx = res.data.rates; - Object.keys(fx).map(symbol => { - rates[symbol] = fx[symbol] / fx["USD"]; - }); + if (fx) { + Object.keys(fx).map(symbol => { + rates[symbol] = fx[symbol] / fx["USD"]; + if (symbol === "VEF") rates[symbol] *= 5; + }); - app.set("rates", rates); + app.set("rates", rates); + } else { + l("Problem fetching rates", res); + } } catch (e) { l(e); } -- cgit v1.2.3