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

View File

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