diff --git a/src/botPage/common/symbolApi/index.js b/src/botPage/common/symbolApi/index.js index 929a115407..ef2f1d1035 100644 --- a/src/botPage/common/symbolApi/index.js +++ b/src/botPage/common/symbolApi/index.js @@ -44,13 +44,7 @@ export default class _Symbol { constructor(api) { this.api = api; this.initPromise = new Promise(resolve => { - // Authorize when possible for accurate offered symbols, assetindex - const promises = []; - const tokenList = getTokenList(); - if (tokenList.length) { - promises.push(this.api.authorize(tokenList[0].token)); - } - Promise.all(promises).finally(() => { + const getActiveSymbolsPromise = () => { this.api.getActiveSymbolsBrief().then(r => { this.activeSymbols = new ActiveSymbols(r.active_symbols); this.api.getAssetIndex().then(r2 => { @@ -58,7 +52,18 @@ export default class _Symbol { resolve(); }, noop); }, noop); - }, noop); + }; + // Authorize when possible for accurate offered symbols, assetindex + const getAuthorisePromise = () => { + const tokenList = getTokenList(); + if (tokenList.length) { + return this.api.authorize(tokenList[0].token); + } + return new Promise(r => r()); + }; + getAuthorisePromise() + .then(() => getActiveSymbolsPromise(), noop) + .catch(() => getActiveSymbolsPromise(), noop); }); } /* eslint-disable class-methods-use-this */ diff --git a/src/botPage/view/blockly/blocks/trade/tradeOptions.js b/src/botPage/view/blockly/blocks/trade/tradeOptions.js index 752c07fdd5..40cbadc6e5 100644 --- a/src/botPage/view/blockly/blocks/trade/tradeOptions.js +++ b/src/botPage/view/blockly/blocks/trade/tradeOptions.js @@ -31,9 +31,11 @@ export default () => { if (ev.name === 'SYMBOL_LIST' || ev.name === 'TRADETYPE_LIST') { // eslint-disable-next-line no-underscore-dangle if (ev.oldValue !== ev.newValue && this.parentBlock_ !== null) { + const durationTypeList = this.getField('DURATIONTYPE_LIST'); + if (durationTypeList === null) return; + const symbol = getSelectedSymbol(this); const tradeType = getTradeType(this); - const durationTypeList = this.getField('DURATIONTYPE_LIST'); const prevSelectedDuration = durationTypeList.getValue(); this.setFieldValue(translate('Loading...'), 'DURATIONTYPE_LIST');