X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=cmd%2Fweb%2Fjs%2Fpoloniex.jsx;h=482dbb6c9b437ca2f0bf2af7e93ed2378810ff55;hb=6b3f0ad04550060fd25b87b68c3f9bc1602f3226;hp=96384fd35ac501ee62a918a2620c90d5af9d3564;hpb=989fb5c7dbba174f54f3ae69df788d6685fff46b;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FCryptoportfolio%2FFront.git diff --git a/cmd/web/js/poloniex.jsx b/cmd/web/js/poloniex.jsx index 96384fd..482dbb6 100644 --- a/cmd/web/js/poloniex.jsx +++ b/cmd/web/js/poloniex.jsx @@ -1,11 +1,10 @@ import Api from './api.js'; -import classNames from 'classnames'; import React from 'react'; class PoloniexController extends React.Component { constructor(props) { super(props); - this.state = {'apiKey': '', 'apiSecret': '', 'flag': 'loading', 'valueCurrency': null, 'balanceValue': null, 'balance': null}; + this.state = {'apiKey': '', 'apiSecret': '', 'apiRequested': false, 'flag': 'loading', 'valueCurrency': null, 'balanceValue': null, 'balance': null}; } handleCredentialsChange = (key, secret) => { @@ -43,6 +42,7 @@ class PoloniexController extends React.Component { componentDidMount = () => { Api.Call('MARKET', {'name': 'poloniex'}, function(err, status, data) { + this.setState({'apiRequested': true}); if (err) { console.error(err, data); return; @@ -74,6 +74,9 @@ class PoloniexController extends React.Component { default: displayText = null; } + if (this.state.apiRequested === false) { + return
; + } return (
{ + return {this.props.currency}; + } +} + class PoloniexBalance extends React.Component { constructor(props) { super(props); @@ -102,19 +114,19 @@ class PoloniexBalance extends React.Component { if (this.props.balanceValue !== null) { var balance = Object.keys(this.props.balance).map(function(currency) { - return
{this.props.balance[currency]}
; + return
+ {this.props.balance[currency]} +
; }.bind(this)); dashboard =
-
-
+
{balance} -
- Balance ({this.props.balanceCurrency}): {this.props.balanceValue} + Balance ({this.props.balanceCurrency}): {this.props.balanceValue}
; @@ -129,7 +141,7 @@ class PoloniexBalance extends React.Component { return (
-
+
Portfolio
@@ -173,7 +185,7 @@ class PoloniexCredentialsForm extends React.Component { return (
-
+
Poloniex credentials