Add default value for onConversionSuccessful

This commit is contained in:
Fabio Berger 2017-12-15 11:05:53 -06:00
parent ac1fbeb962
commit 94f40a54b4

View File

@ -32,6 +32,7 @@ export class EthWethConversionButton extends
React.Component<EthWethConversionButtonProps, EthWethConversionButtonState> { React.Component<EthWethConversionButtonProps, EthWethConversionButtonState> {
public static defaultProps: Partial<EthWethConversionButtonProps> = { public static defaultProps: Partial<EthWethConversionButtonProps> = {
isDisabled: false, isDisabled: false,
onConversionSuccessful: _.noop,
}; };
public constructor(props: EthWethConversionButtonProps) { public constructor(props: EthWethConversionButtonProps) {
super(props); super(props);
@ -100,9 +101,7 @@ export class EthWethConversionButton extends
if (!this.props.isOutdatedWrappedEther) { if (!this.props.isOutdatedWrappedEther) {
this.props.dispatcher.replaceTokenBalanceByAddress(token.address, balance); this.props.dispatcher.replaceTokenBalanceByAddress(token.address, balance);
} }
if (!_.isUndefined(this.props.onConversionSuccessful)) { this.props.onConversionSuccessful();
this.props.onConversionSuccessful();
}
} catch (err) { } catch (err) {
const errMsg = '' + err; const errMsg = '' + err;
if (_.includes(errMsg, BlockchainCallErrs.USER_HAS_NO_ASSOCIATED_ADDRESSES)) { if (_.includes(errMsg, BlockchainCallErrs.USER_HAS_NO_ASSOCIATED_ADDRESSES)) {