Redux #115
3 changed files with 44 additions and 24 deletions
|
@ -7,6 +7,7 @@ import {
|
||||||
} from 'actions/app'
|
} from 'actions/app'
|
||||||
import {
|
import {
|
||||||
doGetNewAddress,
|
doGetNewAddress,
|
||||||
|
doCheckAddressIsMine,
|
||||||
} from 'actions/wallet'
|
} from 'actions/wallet'
|
||||||
import {
|
import {
|
||||||
selectCurrentPage,
|
selectCurrentPage,
|
||||||
|
@ -34,6 +35,7 @@ const select = (state) => ({
|
||||||
const perform = (dispatch) => ({
|
const perform = (dispatch) => ({
|
||||||
closeModal: () => dispatch(doCloseModal()),
|
closeModal: () => dispatch(doCloseModal()),
|
||||||
getNewAddress: () => dispatch(doGetNewAddress()),
|
getNewAddress: () => dispatch(doGetNewAddress()),
|
||||||
|
checkAddressIsMine: (address) => dispatch(doCheckAddressIsMine(address))
|
||||||
})
|
})
|
||||||
|
|
||||||
export default connect(select, perform)(WalletPage)
|
export default connect(select, perform)(WalletPage)
|
||||||
|
|
|
@ -12,12 +12,17 @@ import {
|
||||||
CreditAmount
|
CreditAmount
|
||||||
} from 'component/common';
|
} from 'component/common';
|
||||||
|
|
||||||
const AddressSection = (props) => {
|
class AddressSection extends React.Component {
|
||||||
|
componentWillMount() {
|
||||||
|
this.props.checkAddressIsMine(this.props.receiveAddress)
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
const {
|
const {
|
||||||
receiveAddress,
|
receiveAddress,
|
||||||
getNewAddress,
|
getNewAddress,
|
||||||
gettingNewAddress,
|
gettingNewAddress,
|
||||||
} = props
|
} = this.props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="card">
|
<section className="card">
|
||||||
|
@ -38,6 +43,7 @@ const AddressSection = (props) => {
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var SendToAddressSection = React.createClass({
|
var SendToAddressSection = React.createClass({
|
||||||
|
|
|
@ -45,6 +45,18 @@ reducers[types.UPDATE_BALANCE] = function(state, action) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reducers[types.CHECK_ADDRESS_IS_MINE_STARTED] = function(state, action) {
|
||||||
|
return Object.assign({}, state, {
|
||||||
|
checkingAddressOwnership: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
reducers[types.CHECK_ADDRESS_IS_MINE_COMPLETED] = function(state, action) {
|
||||||
|
return Object.assign({}, state, {
|
||||||
|
checkingAddressOwnership: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export default function reducer(state = defaultState, action) {
|
export default function reducer(state = defaultState, action) {
|
||||||
const handler = reducers[action.type];
|
const handler = reducers[action.type];
|
||||||
if (handler) return handler(state, action);
|
if (handler) return handler(state, action);
|
||||||
|
|
Loading…
Reference in a new issue