X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=cmd%2Fweb%2Fjs%2Fpoloniex.jsx;h=813a506a60d9af3e7a03426b4a1cd3577c32c08f;hb=908ee2dd22c85d5d850f62b1a9d0066b43b80a69;hp=a5fb9a74d49bb3ac45b933c088bb184c18038e75;hpb=adf936f66a5c59e6cc2e7a1c644148e0f119e5c8;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FCryptoportfolio%2FFront.git diff --git a/cmd/web/js/poloniex.jsx b/cmd/web/js/poloniex.jsx index a5fb9a7..813a506 100644 --- a/cmd/web/js/poloniex.jsx +++ b/cmd/web/js/poloniex.jsx @@ -1,5 +1,4 @@ import Api from './api.js'; -import classNames from 'classnames'; import React from 'react'; class PoloniexController extends React.Component { @@ -33,6 +32,8 @@ class PoloniexController extends React.Component { console.error(err, data); if (err.code === 'invalid_market_credentials') { this.setState({'flag': 'invalidCredentials', 'valueCurrency': null, 'balanceValue': null, 'balance': null}); + } else if (err.code === 'ip_restricted_api_key') { + this.setState({'flag': 'ipRestricted', 'valueCurrency': null, 'balanceValue': null, 'balance': null}); } return; } @@ -69,6 +70,9 @@ class PoloniexController extends React.Component { case 'invalidCredentials': displayText = 'Invalid poloniex credentials'; break; + case 'ipRestricted': + displayText = 'Your API key is IP restricted. Please whitelist us.'; + break; case 'emptyCredentials': displayText = 'Please provide poloniex credentials'; break; @@ -94,6 +98,15 @@ class PoloniexController extends React.Component { } } +class CurrencyLogo extends React.Component { + render = () => { + return {this.props.currency}; + } +} + class PoloniexBalance extends React.Component { constructor(props) { super(props); @@ -106,19 +119,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}
; @@ -133,7 +146,7 @@ class PoloniexBalance extends React.Component { return (
-
+
Portfolio
@@ -177,7 +190,7 @@ class PoloniexCredentialsForm extends React.Component { return (
-
+
Poloniex credentials