2018-10-29 18:23:53 +01:00
|
|
|
import * as MODALS from 'constants/modal_types';
|
2017-12-21 22:08:54 +01:00
|
|
|
import { connect } from 'react-redux';
|
2018-10-29 18:23:53 +01:00
|
|
|
import { doOpenModal } from 'redux/actions/app';
|
2020-06-15 22:33:03 +02:00
|
|
|
import { doUserIdentityVerify, doUserFetch } from 'redux/actions/user';
|
|
|
|
import { makeSelectRewardByType } from 'redux/selectors/rewards';
|
|
|
|
import rewards from 'rewards';
|
|
|
|
import { selectIdentityVerifyIsPending, selectIdentityVerifyErrorMessage } from 'redux/selectors/user';
|
2017-12-21 22:08:54 +01:00
|
|
|
import UserVerify from './view';
|
2017-06-03 01:09:52 +02:00
|
|
|
|
2018-05-17 22:31:49 +02:00
|
|
|
const select = state => {
|
2017-07-19 01:00:13 +02:00
|
|
|
const selectReward = makeSelectRewardByType();
|
|
|
|
|
|
|
|
return {
|
|
|
|
isPending: selectIdentityVerifyIsPending(state),
|
|
|
|
errorMessage: selectIdentityVerifyErrorMessage(state),
|
2018-05-17 22:31:49 +02:00
|
|
|
reward: selectReward(state, rewards.TYPE_NEW_USER),
|
2017-07-19 01:00:13 +02:00
|
|
|
};
|
|
|
|
};
|
2017-06-03 01:09:52 +02:00
|
|
|
|
2017-06-08 02:56:52 +02:00
|
|
|
const perform = dispatch => ({
|
2017-07-19 01:00:13 +02:00
|
|
|
verifyUserIdentity: token => dispatch(doUserIdentityVerify(token)),
|
2018-10-29 18:23:53 +01:00
|
|
|
verifyPhone: () => dispatch(doOpenModal(MODALS.PHONE_COLLECTION)),
|
2019-10-14 21:54:06 +02:00
|
|
|
fetchUser: () => dispatch(doUserFetch()),
|
2017-06-08 02:56:52 +02:00
|
|
|
});
|
2017-06-03 01:09:52 +02:00
|
|
|
|
2020-06-15 22:33:03 +02:00
|
|
|
export default connect(select, perform)(UserVerify);
|