aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2019-10-07 20:37:35 -0700
committerAdam Soltys <[email protected]>2019-10-07 20:37:35 -0700
commit67b6cfb95f586503341696a9625514edec744606 (patch)
treef54dd2865d88c0227a2798e592035c9aadcdf09a
parent866e864f1dbd5125da2245400f214a2c6dd5d8fe (diff)
downloadcoinos-server-67b6cfb95f586503341696a9625514edec744606.tar.gz
coinos-server-67b6cfb95f586503341696a9625514edec744606.zip
check for rates before setting
-rw-r--r--rates.js13
1 files 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);
}