1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-23 02:10:12 +01:00

Add data field to pass up parameters up to reducer.

This commit is contained in:
Kevin Serrano 2016-07-21 10:15:34 -07:00
parent 491b9cddc5
commit 4a9d5b1c25
4 changed files with 20 additions and 3 deletions

View File

@ -99,6 +99,8 @@ IdentityStore.prototype.getState = function () {
unconfMsgs: messageManager.unconfirmedMsgs(),
messages: messageManager.getMsgList(),
selectedAddress: configManager.getSelectedAccount(),
currentFiat: configManager.getCurrentFiat(),
currentConversion: configManager.getConversionRate(),
}))
}
@ -199,7 +201,7 @@ IdentityStore.prototype.addUnconfirmedTransaction = function (txParams, onTxDone
time: time,
status: 'unconfirmed',
}
console.log('addUnconfirmedTransaction:', txData)
// keep the onTxDoneCb around for after approval/denial (requires user interaction)

View File

@ -241,8 +241,13 @@ module.exports = class MetamaskController {
try {
this.configManager.setCurrentFiat(fiat)
this.configManager.setConversionRate()
const data = {
conversionRate: this.configManager.getConversionRate,
currentFiat: this.configManager.getCurrentFiat,
}
cb(data)
} catch (e) {
cb(e)
cb(null,e)
}
}

View File

@ -212,10 +212,14 @@ function revealAccount () {
function setCurrentFiat (fiat) {
return (dispatch) => {
dispatch(this.showLoadingIndication())
_accountManager.setCurrentFiat(fiat, (err) => {
_accountManager.setCurrentFiat(fiat, (data, err) => {
dispatch(this.hideLoadingIndication())
dispatch({
type: this.SET_CURRENT_FIAT,
value: {
currentFiat: data.currentFiat,
conversionRate: data.conversionRate,
}
})
})
}

View File

@ -109,6 +109,12 @@ function reduceMetamask (state, action) {
var identities = extend(metamaskState.identities, id)
return extend(metamaskState, { identities })
case actions.SET_CURRENT_FIAT:
return extend(metaMaskState, {
currentFiat: action.value.currentFiat,
conversionRate: action.value.conversionRate,
})
default:
return metamaskState