Display toaster after Contract was downloaded

This commit is contained in:
fernandomg 2017-11-03 16:26:26 -03:00
parent 29c9fd0944
commit fee1ea060b
1 changed files with 13 additions and 1 deletions

View File

@ -14,6 +14,7 @@ import { DisplayTextArea } from '../Common/DisplayTextArea'
import { Loader } from '../Common/Loader'
import { NAVIGATION_STEPS, TRUNC_TO_DECIMALS } from '../../utils/constants'
import { copy } from '../../utils/copy';
import AlertContainer from 'react-alert'
const { PUBLISH } = NAVIGATION_STEPS
export class stepFour extends stepTwo {
@ -21,6 +22,7 @@ export class stepFour extends stepTwo {
super(props);
let oldState = getOldState(props, defaultState)
this.state = Object.assign({}, oldState)
this.alertOptions = { time: 10000, position: 'top right' }
console.log('oldState oldState oldState', oldState)
}
@ -476,7 +478,6 @@ export class stepFour extends stepTwo {
let web3 = this.state.web3;
let contracts = this.state.contracts;
console.log(contracts);
this.downloadCrowdsaleInfo();
this.setState(() => {
setLastCrowdsaleRecursive(0, web3, contracts.pricingStrategy.abi, contracts.pricingStrategy.addr, contracts.crowdsale.addr.slice(-1)[0], 142982, (err) => {
@ -497,6 +498,8 @@ export class stepFour extends stepTwo {
transferOwnership(web3, this.state.contracts.token.abi, contracts.token.addr, this.state.crowdsale[0].walletAddress, 46699, (err) => {
if (err) return this.hideLoader();
this.hideLoader();
this.downloadCrowdsaleInfo();
this.showToaster({ message: 'A file with contracts and metadata downloaded on your computer' })
//this.goToCrowdsalePage();
});
});
@ -534,6 +537,14 @@ export class stepFour extends stepTwo {
this.props.history.push(newHistory);
}
showToaster = ({type = 'info', message = ''}) => {
if (!message) {
return
}
this.msg[type](message);
}
render() {
let crowdsaleSetups = [];
for (let i = 0; i < this.state.crowdsale.length; i++) {
@ -767,6 +778,7 @@ export class stepFour extends stepTwo {
<a onClick={this.goToCrowdsalePage} className="button button_fill">Continue</a>
</div>
<Loader show={this.state.loading}></Loader>
<AlertContainer ref={a => this.msg = a} {...this.alertOptions} />
</section>
)}
}