From 78e3e81ddf01f41102f3f4e32c5a3955cf5fb04f Mon Sep 17 00:00:00 2001 From: jloup Date: Mon, 7 May 2018 18:50:53 +0200 Subject: [PATCH] Various fixes. --- cmd/web/Makefile | 6 ++++-- cmd/web/js/poloniex.jsx | 11 ++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/cmd/web/Makefile b/cmd/web/Makefile index 3b100d1..52e2289 100644 --- a/cmd/web/Makefile +++ b/cmd/web/Makefile @@ -20,7 +20,7 @@ install: yarn --version yarn install -static: $(STATIC_BUILD_DIR) js $(addprefix $(STATIC_BUILD_DIR)/, $(STATIC_FILES)) $(ICONS) +static: $(STATIC_BUILD_DIR) $(STATIC_BUILD_DIR)/fonts js $(addprefix $(STATIC_BUILD_DIR)/, $(STATIC_FILES)) $(ICONS) js: build/static/main.js @@ -32,7 +32,9 @@ $(STATIC_BUILD_DIR): mkdir -p $@ mkdir -p $@/icons/black mkdir -p $@/icons/color - mkdir -p $@/fonts + +$(STATIC_BUILD_DIR)/fonts: + mkdir -p $@ $(BUILD_DIR)/%.js: $(SRC_DIR)/%.jsx eslint --fix $< diff --git a/cmd/web/js/poloniex.jsx b/cmd/web/js/poloniex.jsx index 76b68d8..edac368 100644 --- a/cmd/web/js/poloniex.jsx +++ b/cmd/web/js/poloniex.jsx @@ -4,7 +4,7 @@ import React from 'react'; class PoloniexController extends React.Component { constructor(props) { super(props); - this.state = {'apiRequested': false, 'flag': 'loading', 'valueCurrency': null, 'balanceValue': null, 'balance': null}; + this.state = {'flag': 'loading', 'valueCurrency': null, 'balanceValue': null, 'balance': null}; } loadBalance = () => { @@ -12,14 +12,14 @@ class PoloniexController extends React.Component { if (err) { console.error(err, data); if (err.code === 'invalid_market_credentials') { - this.setState({'flag': 'invalidCredentials', 'apiRequested': true, 'valueCurrency': null, 'balanceValue': null, 'balance': null}); + this.setState({'flag': 'invalidCredentials', 'valueCurrency': null, 'balanceValue': null, 'balance': null}); } else if (err.code === 'ip_restricted_api_key') { - this.setState({'flag': 'ipRestricted', 'apiRequested': true, 'valueCurrency': null, 'balanceValue': null, 'balance': null}); + this.setState({'flag': 'ipRestricted', 'valueCurrency': null, 'balanceValue': null, 'balance': null}); } return; } - this.setState({'flag': 'ok', 'apiRequested': true, 'valueCurrency': data.valueCurrency, 'balanceValue': data.value, 'balance': data.balance}); + this.setState({'flag': 'ok', 'valueCurrency': data.valueCurrency, 'balanceValue': data.value, 'balance': data.balance}); }.bind(this)); } @@ -41,9 +41,6 @@ class PoloniexController extends React.Component { default: displayText = null; } - if (this.state.apiRequested === false) { - return
; - } return (