Skip to content

Commit

Permalink
♻️ Update hwWallet middleware validate device model
Browse files Browse the repository at this point in the history
  • Loading branch information
Osvaldo Vega committed Jul 3, 2019
1 parent 021815e commit 4903c6f
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/store/middlewares/hwWallet.js
Expand Up @@ -37,21 +37,23 @@ const hwWalletMiddleware = store => next => (action) => {
const { account, settings } = state;
const activeToken = settings.token.active || 'LSK';

if (account.info[activeToken].address) {
if (account.hwInfo && account.hwInfo.deviceId) {
store.dispatch(dialogDisplayed({
childComponent: Alert,
childComponentProps: {
title: 'You are disconnected',
text: `There is no connection to the ${model}. Please check the cables if it happened by accident.`,
closeDialog: () => {
store.dispatch(dialogHidden());
location.reload(); // eslint-disable-line
},
if (account.info[activeToken].address
&& account.hwInfo
&& account.hwInfo.deviceId
&& account.hwInfo.deviceModel === model
) {
store.dispatch(dialogDisplayed({
childComponent: Alert,
childComponentProps: {
title: 'You are disconnected',
text: `There is no connection to the ${model}. Please check the cables if it happened by accident.`,
closeDialog: () => {
store.dispatch(dialogHidden());
location.reload(); // eslint-disable-line
},
}));
store.dispatch(accountLoggedOut());
}
},
}));
store.dispatch(accountLoggedOut());
}

store.dispatch({
Expand Down

0 comments on commit 4903c6f

Please sign in to comment.