diff options
| author | Ran <[email protected]> | 2021-06-17 12:09:33 -0700 |
|---|---|---|
| committer | Ran <[email protected]> | 2021-06-17 12:09:33 -0700 |
| commit | c8c8262ccbcb8a0123e85994356a53ef3c7b7190 (patch) | |
| tree | 7d8889421a2f49e6f668106b320927ba523b5341 | |
| parent | 691e0534884cf37d04f8521838199224fd282428 (diff) | |
| download | coinos-server-c8c8262ccbcb8a0123e85994356a53ef3c7b7190.tar.gz coinos-server-c8c8262ccbcb8a0123e85994356a53ef3c7b7190.zip | |
fix conflict with setting value to const
| -rw-r--r-- | routes/assets.js | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/routes/assets.js b/routes/assets.js index 6e845ac8..076c7057 100644 --- a/routes/assets.js +++ b/routes/assets.js @@ -7,13 +7,13 @@ let fetchAssets; const { data: assets } = await axios.get( "https://assets.blockstream.info/" ); - app.set("assets", assets); + var liquid_assets = require('./../assets.json') + app.set("assets", liquid_assets); } catch (e) { - - assets = require('./../assets.json') - if (assets) { - app.set("assets", assets); - console.debug('using static assets...'); + var liquid_assets = require('./../assets.json') + if (liquid_assets) { + app.set("assets", liquid_assets); + console.debug('using static assets...' + e.message); } else { l.error("error fetching assets", e.message); res.status(500).send("error fetching assets"); @@ -27,11 +27,12 @@ app.get( "/assets", ah(async (req, res) => { if (app.get("assets")) { + const assets = app.get("assets"); + const accounts = await db.Account.findAll({ // group: ["asset"] }); - Object.keys(assets).map(a => { assets[a].registered = true; if (!assets[a].asset) assets[a].asset = assets[a].asset_id; @@ -47,7 +48,6 @@ app.get( ) delete assets[a]; }); - accounts.map(({ asset, name, domain, ticker, precision }) => { if (!assets[asset]) assets[asset] = { @@ -60,8 +60,10 @@ app.get( }); res.send(assets); - } else + } else { + console.log('error getting blockstream assets'); res.status(500).send("Problem fetching blockstream asset registry data"); + } }) ); |
