meriadec
7 years ago
No known key found for this signature in database
GPG Key ID: 1D2FC2305E2CB399
2 changed files with
19 additions and
3 deletions
-
src/components/modals/AddAccount/index.js
-
src/reducers/accounts.js
|
|
@ -270,8 +270,20 @@ class AddAccountModal extends PureComponent<Props, State> { |
|
|
|
} |
|
|
|
|
|
|
|
if (type === 'wallet.getAccounts.success') { |
|
|
|
// As data is passed inside electron event system,
|
|
|
|
// dates are converted to their string equivalent
|
|
|
|
//
|
|
|
|
// so, quick & dirty way to put back Date objects
|
|
|
|
const parsedData = data.map(account => ({ |
|
|
|
...account, |
|
|
|
operations: account.operations.map(op => ({ |
|
|
|
...op, |
|
|
|
date: new Date(op.date), |
|
|
|
})), |
|
|
|
})) |
|
|
|
|
|
|
|
this.setState({ |
|
|
|
accounts: data, |
|
|
|
accounts: parsedData, |
|
|
|
step: 'listAccounts', |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
@ -90,11 +90,15 @@ export function canCreateAccount(state: State): boolean { |
|
|
|
return every(getAccounts(state), a => get(a, 'operations.length', 0) > 0) |
|
|
|
} |
|
|
|
|
|
|
|
export function serializeAccounts(accounts: Account[]) { |
|
|
|
export function serializeAccounts(accounts: AccountRaw[]): Account[] { |
|
|
|
// ensure that accounts are always wrapped in data key
|
|
|
|
if (accounts.length && !accounts[0].data) { |
|
|
|
accounts = accounts.map(account => ({ data: account })) |
|
|
|
} |
|
|
|
return accounts.map(accountModel.decode) |
|
|
|
} |
|
|
|
|
|
|
|
export function deserializeAccounts(accounts: AccountRaw[]) { |
|
|
|
export function deserializeAccounts(accounts: Account[]): AccountRaw[] { |
|
|
|
return accounts.map(accountModel.encode) |
|
|
|
} |
|
|
|
|
|
|
|