X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=cmd%2Fweb%2Fjs%2Faccount.jsx;h=9a976f4c0729bf104bc82ff3a0bdf80e1358a516;hb=a6820180928670b0642fa6a28ac221ce158230bb;hp=c80be33ecfa605878648d1c9b15983c643121a80;hpb=c6aa553f48d1014f651441bbd9e023508d0a819c;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FCryptoportfolio%2FFront.git diff --git a/cmd/web/js/account.jsx b/cmd/web/js/account.jsx index c80be33..9a976f4 100644 --- a/cmd/web/js/account.jsx +++ b/cmd/web/js/account.jsx @@ -1,15 +1,47 @@ import Api from './api.js'; import React from 'react'; +import Panel from './panel.js'; + +class AccountInformation extends React.Component { + constructor(props) { + super(props); + this.state = {'email': null}; + } + + loadAccount = () => { + Api.Call('USER_ACCOUNT', {}, function(err, status, data) { + if (err) { + console.error(err, data); + return; + } + + this.setState({'email': data.email}); + }.bind(this)); + } + + componentDidMount = () => { + this.loadAccount(); + } + + render = () => { + var component =
Loading...
; + if (this.state.email !== null) { + component =Email: {this.state.email}
; + } + + return component; + } + +} class PoloniexConfiguration extends React.Component { constructor(props) { super(props); - this.state = {'apiKey': '', 'apiSecret': '', 'apiRequested': false, 'status': 'loading', 'editMode': false}; + this.state = {'apiKey': '', 'apiSecret': '', 'status': 'loading', 'editMode': false}; } checkCredentials = () => { Api.Call('MARKET_TEST_CREDENTIALS', {'name': 'poloniex'}, function(err, status, data) { - this.setState({'apiRequested': true}); if (err) { console.error(err, data); if (err.code === 'invalid_market_credentials') { @@ -53,7 +85,7 @@ class PoloniexConfiguration extends React.Component { onEditClick = () => { Api.Call('MARKET', {'name': 'poloniex'}, function(err, status, data) { - this.setState({'apiRequested': true, 'editMode': true}); + this.setState({'editMode': true}); if (err) { console.error(err, data); return; @@ -90,11 +122,8 @@ class PoloniexConfiguration extends React.Component { console.error('unknown status', this.state.status); displayText = null; } - if (this.state.apiRequested === false) { - return ; - } + return ( -