address additional comments

This commit is contained in:
Daniel Ternyak 2017-06-18 23:56:32 -05:00
parent c77f5ef300
commit 3cf43d04ad
2 changed files with 14 additions and 10 deletions

View File

@ -6,9 +6,9 @@ import {
SWAP_DESTINATION_AMOUNT_TO, SWAP_DESTINATION_AMOUNT_TO,
SWAP_DESTINATION_KIND_TO, SWAP_DESTINATION_KIND_TO,
SWAP_ORIGIN_AMOUNT_TO, SWAP_ORIGIN_AMOUNT_TO,
SWAP_ORIGIN_KIND_AND_DESTINATION_KIND_AND_DESTINATION_OPTIONS_TO,
SWAP_ORIGIN_KIND_TO, SWAP_ORIGIN_KIND_TO,
SWAP_UPDATE_BITY_RATES_TO, SWAP_UPDATE_BITY_RATES_TO
SWAP_ORIGIN_KIND_AND_DESTINATION_KIND_AND_DESTINATION_OPTIONS_TO
} from 'actions/swap'; } from 'actions/swap';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
@ -36,6 +36,17 @@ class Swap extends Component {
swapOriginKindAndDestinationKindAndDestinationOptionsTo: PropTypes.func swapOriginKindAndDestinationKindAndDestinationOptionsTo: PropTypes.func
}; };
componentDidMount() {
let {bityRates} = this.props;
if (!bityRates.ETHBTC || !bityRates.ETHREP || !bityRates.BTCETH || !bityRates.BTCREP) {
this.bity.getAllRates()
.then((data) => {
this.props.swapUpdateBityRatesTo(data);
})
}
}
render() { render() {
let { let {
bityRates, bityRates,
@ -67,14 +78,6 @@ class Swap extends Component {
swapOriginKindAndDestinationKindAndDestinationOptionsTo swapOriginKindAndDestinationKindAndDestinationOptionsTo
}; };
if (!bityRates.ETHBTC || !bityRates.ETHREP || !bityRates.BTCETH || !bityRates.BTCREP) {
this.bity.getAllRates()
.then((data) => {
this.props.swapUpdateBityRatesTo(data);
})
}
return ( return (
<section className="container" style={{minHeight: '50%'}}> <section className="container" style={{minHeight: '50%'}}>
<div className="tab-content"> <div className="tab-content">

View File

@ -37,6 +37,7 @@ const configureStore = () => {
const renderRoot = (Root) => { const renderRoot = (Root) => {
let store = configureStore(); let store = configureStore();
window.store = store;
let syncedHistory = syncHistoryWithStore(history, store); let syncedHistory = syncHistoryWithStore(history, store);
render( render(
<Root key={Math.random()} <Root key={Math.random()}