]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Front.git/blobdiff - cmd/web/js/poloniex.jsx
/not_confirmed page.
[perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Front.git] / cmd / web / js / poloniex.jsx
index 96384fd35ac501ee62a918a2620c90d5af9d3564..a5fb9a74d49bb3ac45b933c088bb184c18038e75 100644 (file)
@@ -5,7 +5,7 @@ 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 +43,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 +75,9 @@ class PoloniexController extends React.Component {
       default:
         displayText = null;
     }
+    if (this.state.apiRequested === false) {
+      return <div></div>;
+    }
     return (
       <div>
         <PoloniexBalance  balanceCurrency={this.state.valueCurrency}