From e9a4f6c72b7e3d4527b36cb4c1685f1d2e26bfb4 Mon Sep 17 00:00:00 2001 From: Barry Gitarts Date: Mon, 1 Oct 2018 16:41:02 -0400 Subject: [PATCH] remove on page load contact code request, move to displaybox click --- app/components/ens/nameLookup.js | 13 +++++++++++-- app/store/init.js | 3 +-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/components/ens/nameLookup.js b/app/components/ens/nameLookup.js index 880d302..086d7ce 100644 --- a/app/components/ens/nameLookup.js +++ b/app/components/ens/nameLookup.js @@ -3,6 +3,7 @@ import web3 from 'web3'; import EmbarkJS from 'Embark/EmbarkJS'; import { connect } from 'react-redux'; import { actions as accountActions, getDefaultAccount } from '../../reducers/accounts'; +import { checkAndDispatchStatusContactCode } from '../../actions/accounts'; import { hash } from 'eth-ens-namehash'; import { isNil } from 'lodash'; import Hidden from '@material-ui/core/Hidden'; @@ -64,8 +65,8 @@ const backButton = { const validTimestamp = timestamp => Number(timestamp) > 99999999; const generatePrettyDate = timestamp => new Date(timestamp * 1000).toDateString(); -const DisplayBox = ({ displayType, pubKey }) => ( -
+const WrappedDisplayBox = ({ displayType, pubKey, getStatusContactCode }) => ( +
{displayType}
@@ -75,6 +76,14 @@ const DisplayBox = ({ displayType, pubKey }) => (
); +const mapDispatchToDisplayBoxProps = dispatch => ({ + getStatusContactCode() { + checkAndDispatchStatusContactCode(dispatch) + } +}); + +const DisplayBox = connect(null, mapDispatchToDisplayBoxProps)(WrappedDisplayBox); + const MobileAddressDisplay = ({ domainName, address, statusAccount, expirationTime, defaultAccount, isOwner, edit, onSubmit, handleChange, values, handleSubmit }) => ( diff --git a/app/store/init.js b/app/store/init.js index 2c9edee..5515005 100644 --- a/app/store/init.js +++ b/app/store/init.js @@ -1,14 +1,13 @@ import web3 from "Embark/web3" import EmbarkJS from 'Embark/EmbarkJS' import store from './configureStore' -import { fetchAndDispatchSNTAllowance, fetchAndDispatchAccountsWithBalances, checkAndDispatchStatusContactCode } from '../actions/accounts' +import { fetchAndDispatchSNTAllowance, fetchAndDispatchAccountsWithBalances } from '../actions/accounts' const dispatch = action => store.dispatch(action) export default () => { EmbarkJS.onReady(async (err) => { fetchAndDispatchAccountsWithBalances(web3, dispatch) - checkAndDispatchStatusContactCode(dispatch) fetchAndDispatchSNTAllowance(dispatch) }) }