sms verification: simplify code

- moved the steps into named exports
- moved the store creation into the Accounts component
- fix a linting issue
This commit is contained in:
Jannis R
2016-11-15 16:59:10 +01:00
parent 3e879aac35
commit aa8fc554fe
4 changed files with 55 additions and 57 deletions

View File

@@ -30,9 +30,15 @@ import shapeshiftBtn from '../../../assets/images/shapeshift-btn.png';
import Header from './Header';
import Transactions from './Transactions';
import VerificationStore from '../../modals/SMSVerification/store';
import styles from './account.css';
class Account extends Component {
static contextTypes = {
api: PropTypes.object.isRequired
}
static propTypes = {
params: PropTypes.object,
accounts: PropTypes.object,
@@ -47,10 +53,19 @@ class Account extends Component {
showEditDialog: false,
showFundDialog: false,
showVerificationDialog: false,
verificationStore: null,
showTransferDialog: false,
showPasswordDialog: false
}
componentDidMount () {
const { api } = this.context;
const { address } = this.props.params;
const store = new VerificationStore(api, address);
this.setState({ verificationStore: store });
}
render () {
const { accounts, balances, isTest } = this.props;
const { address } = this.props.params;
@@ -162,12 +177,12 @@ class Account extends Component {
return null;
}
const store = this.state.verificationStore;
const { address } = this.props.params;
// TODO: pass props
return (
<SMSVerification
account={ address }
store={ store } account={ address }
onClose={ this.onVerificationClose }
/>
);