Skip to content

Commit

Permalink
♻️ refactor use peerAddress instead of address when saving account
Browse files Browse the repository at this point in the history
  • Loading branch information
faival committed Jul 13, 2018
1 parent 0cf55de commit 5076435
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/store/middlewares/savedAccounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const savedAccountsMiddleware = (store) => {

/* istanbul ignore if */
if (account.network === networks.customNode.code) {
network.address = account.address;
network.address = account.peerAddress;
}

store.dispatch(activePeerSet({
Expand Down
8 changes: 4 additions & 4 deletions src/utils/savedAccounts.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { validateUrl } from './login';
import { extractAddress } from './account';

const isValidSavedAccount = ({ publicKey, network, address }) => {
const isValidSavedAccount = ({ publicKey, network, peerAddress }) => {
try {
return extractAddress(publicKey) &&
network >= 0 && network <= 2 &&
(validateUrl(address).addressValidity === '' || network !== 2);
(validateUrl(peerAddress).addressValidity === '' || network !== 2);
} catch (e) {
return false;
}
Expand All @@ -21,9 +21,9 @@ export const getSavedAccounts = () => {

export const setSavedAccounts = (accounts) => {
accounts = accounts.map(({
publicKey, network, address, balance,
publicKey, network, address, balance, peerAddress,
}) => ({
publicKey, network, address, balance,
publicKey, network, address, balance, peerAddress,
}));
localStorage.setItem('accounts', JSON.stringify(accounts));
};
Expand Down

0 comments on commit 5076435

Please sign in to comment.