diff options
| author | Adam Soltys <[email protected]> | 2019-10-07 20:37:35 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2019-10-07 20:37:35 -0700 |
| commit | 67b6cfb95f586503341696a9625514edec744606 (patch) | |
| tree | f54dd2865d88c0227a2798e592035c9aadcdf09a | |
| parent | 866e864f1dbd5125da2245400f214a2c6dd5d8fe (diff) | |
| download | coinos-server-67b6cfb95f586503341696a9625514edec744606.tar.gz coinos-server-67b6cfb95f586503341696a9625514edec744606.zip | |
check for rates before setting
| -rw-r--r-- | rates.js | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -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); } |
