fetch certifications in account view

This commit is contained in:
Jannis R 2016-12-08 22:58:24 +01:00
parent 409c4adfbf
commit e1c5796a5c
No known key found for this signature in database
GPG Key ID: 0FE83946296A88A5
2 changed files with 11 additions and 16 deletions

View File

@ -19,7 +19,6 @@ import { connect } from 'react-redux';
import { bindActionCreators } from 'redux'; import { bindActionCreators } from 'redux';
import { hashToImageUrl } from '~/redux/providers/imagesReducer'; import { hashToImageUrl } from '~/redux/providers/imagesReducer';
import { fetchCertifications } from '~/redux/providers/certifications/actions';
import defaultIcon from '../../../assets/images/certifications/unknown.svg'; import defaultIcon from '../../../assets/images/certifications/unknown.svg';
@ -29,14 +28,7 @@ class Certifications extends Component {
static propTypes = { static propTypes = {
account: PropTypes.string.isRequired, account: PropTypes.string.isRequired,
certifications: PropTypes.array.isRequired, certifications: PropTypes.array.isRequired,
dappsUrl: PropTypes.string.isRequired, dappsUrl: PropTypes.string.isRequired
fetchCertifications: PropTypes.func.isRequired
}
componentWillMount () {
const { account, fetchCertifications } = this.props;
fetchCertifications(account);
} }
render () { render () {
@ -77,11 +69,7 @@ function mapStateToProps (_, initProps) {
}; };
} }
function mapDispatchToProps (dispatch) {
return bindActionCreators({ fetchCertifications }, dispatch);
}
export default connect( export default connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps null
)(Certifications); )(Certifications);

View File

@ -31,6 +31,7 @@ import shapeshiftBtn from '../../../assets/images/shapeshift-btn.png';
import Header from './Header'; import Header from './Header';
import Transactions from './Transactions'; import Transactions from './Transactions';
import { setVisibleAccounts } from '~/redux/providers/personalActions'; import { setVisibleAccounts } from '~/redux/providers/personalActions';
import { fetchCertifiers, fetchCertifications } from '~/redux/providers/certifications/actions';
import VerificationStore from '~/modals/SMSVerification/store'; import VerificationStore from '~/modals/SMSVerification/store';
@ -43,6 +44,8 @@ class Account extends Component {
static propTypes = { static propTypes = {
setVisibleAccounts: PropTypes.func.isRequired, setVisibleAccounts: PropTypes.func.isRequired,
fetchCertifiers: PropTypes.func.isRequired,
fetchCertifications: PropTypes.func.isRequired,
images: PropTypes.object.isRequired, images: PropTypes.object.isRequired,
params: PropTypes.object, params: PropTypes.object,
@ -62,6 +65,7 @@ class Account extends Component {
} }
componentDidMount () { componentDidMount () {
this.props.fetchCertifiers();
this.setVisibleAccounts(); this.setVisibleAccounts();
} }
@ -88,9 +92,10 @@ class Account extends Component {
} }
setVisibleAccounts (props = this.props) { setVisibleAccounts (props = this.props) {
const { params, setVisibleAccounts } = props; const { params, setVisibleAccounts, fetchCertifications } = props;
const addresses = [ params.address ]; const addresses = [ params.address ];
setVisibleAccounts(addresses); setVisibleAccounts(addresses);
fetchCertifications(params.address);
} }
render () { render () {
@ -344,7 +349,9 @@ function mapStateToProps (state) {
function mapDispatchToProps (dispatch) { function mapDispatchToProps (dispatch) {
return bindActionCreators({ return bindActionCreators({
setVisibleAccounts setVisibleAccounts,
fetchCertifiers,
fetchCertifications
}, dispatch); }, dispatch);
} }