]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Front.git/blobdiff - cmd/web/js/poloniex.jsx
Various fixes.
[perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Front.git] / cmd / web / js / poloniex.jsx
index 76b68d8913312ff7f3640b4f87c98804c3311284..edac368e84d07f02d2060d838481d7853cab04a3 100644 (file)
@@ -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 <div></div>;
-    }
     return (
       <div>
         <PoloniexBalance  balanceCurrency={this.state.valueCurrency}