Skip to content

Commit

Permalink
Fixed issue where "Upgrade Wallet" wouldn't always resolve issues.
Browse files Browse the repository at this point in the history
Fixes #556
  • Loading branch information
aaroncox committed Feb 24, 2019
1 parent 755d92f commit 45fe2d6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
11 changes: 7 additions & 4 deletions app/shared/actions/wallets.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,14 @@ export function upgradeWallet(chainId, account, authorization, password = false,
connection,
wallets
} = getState();
const [current] = partition(wallets, {
const partitionQuery = {
account,
authorization,
chainId
});
};
if (authorization) {
partitionQuery.authorization = authorization
}
const [current] = partition(wallets, partitionQuery);
if (current.length > 0) {
eos(connection).getAccount(account).then((accountData) => {
const wallet = current[0];
Expand All @@ -290,7 +293,7 @@ export function upgradeWallet(chainId, account, authorization, password = false,
}
});
if (swap === true) {
dispatch(useWallet(current.chainId, account, auth));
dispatch(useWallet(chainId, account, auth));
}
return false;
}).catch((err) => dispatch({
Expand Down
9 changes: 6 additions & 3 deletions app/shared/reducers/wallets.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,14 @@ export default function wallets(state = initialState, action) {
return other;
}
case types.UPGRADE_WALLET: {
const [current, other] = partition(state, {
const partitionQuery = {
account: action.payload.account,
authorization: action.payload.oldAuthorization,
chainId: action.payload.chainId,
});
};
if (action.payload.oldAuthorization) {
partitionQuery.authorization = action.payload.oldAuthorization;
}
const [current, other] = partition(state, partitionQuery);
if (current.length > 0) {
const modified = Object.assign({}, current[0]);
modified.accountData = action.payload.accountData;
Expand Down

0 comments on commit 45fe2d6

Please sign in to comment.