mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Add date access throughout the data flow.
This commit is contained in:
parent
66941f0808
commit
716e65424d
@ -288,7 +288,7 @@ ConfigManager.prototype.setConversionRate = function () {
|
||||
.then(function (response) {
|
||||
const parsedResponse = JSON.parse(response)
|
||||
data.conversionRate = Number(parsedResponse.ticker.price)
|
||||
data.conversionLastUpdated = new Date(parsedResponse.timestamp).toString()
|
||||
data.conversionDate = new Date(parsedResponse.timestamp).toString()
|
||||
this.setData(data)
|
||||
}.bind(this)).catch(function (err) {
|
||||
console.log('Error in conversion.', err)
|
||||
@ -300,7 +300,7 @@ ConfigManager.prototype.getConversionRate = function () {
|
||||
return ('conversionRate' in data) && data.conversionRate
|
||||
}
|
||||
|
||||
ConfigManager.prototype.getConversionLastUpdated = function () {
|
||||
ConfigManager.prototype.getConversionDate = function () {
|
||||
var data = this.getData()
|
||||
return ('conversionLastUpdated' in data) && data.conversionLastUpdated
|
||||
return ('conversionDate' in data) && data.conversionDate
|
||||
}
|
||||
|
@ -100,7 +100,8 @@ IdentityStore.prototype.getState = function () {
|
||||
messages: messageManager.getMsgList(),
|
||||
selectedAddress: configManager.getSelectedAccount(),
|
||||
currentFiat: configManager.getCurrentFiat(),
|
||||
currentConversion: configManager.getConversionRate(),
|
||||
conversionRate: configManager.getConversionRate(),
|
||||
conversionDate: configManager.getConversionDate(),
|
||||
}))
|
||||
}
|
||||
|
||||
|
@ -245,6 +245,7 @@ module.exports = class MetamaskController {
|
||||
const data = {
|
||||
conversionRate: this.configManager.getConversionRate,
|
||||
currentFiat: this.configManager.getCurrentFiat,
|
||||
conversionDate: this.configManager.getConversionDate,
|
||||
}
|
||||
cb(data)
|
||||
} catch (e) {
|
||||
|
@ -219,6 +219,7 @@ function setCurrentFiat (fiat) {
|
||||
value: {
|
||||
currentFiat: data.currentFiat,
|
||||
conversionRate: data.conversionRate,
|
||||
conversionDate: data.conversionDate,
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -113,6 +113,7 @@ function reduceMetamask (state, action) {
|
||||
return extend(metaMaskState, {
|
||||
currentFiat: action.value.currentFiat,
|
||||
conversionRate: action.value.conversionRate,
|
||||
conversionDate: action.value.conversionDate,
|
||||
})
|
||||
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user