mirror of
https://github.com/trezor/trezor-wallet
synced 2024-12-25 00:18:07 +00:00
fix selectFirstAvailableDevice
Redirect only if first available device is not currently selected fix #117
This commit is contained in:
parent
9a8ac01dcd
commit
c3c3c10350
@ -250,10 +250,14 @@ export const selectDevice = (device: TrezorDevice | Device): ThunkAction => (dis
|
||||
/*
|
||||
* Redirect to first device or landing page
|
||||
*/
|
||||
export const selectFirstAvailableDevice = (): ThunkAction => (dispatch: Dispatch): void => {
|
||||
export const selectFirstAvailableDevice = (): ThunkAction => (dispatch: Dispatch, getState: GetState): void => {
|
||||
const url = dispatch(getFirstAvailableDeviceUrl());
|
||||
if (url) {
|
||||
dispatch(goto(url));
|
||||
const currentParams = getState().router.location.state;
|
||||
const requestedParams = dispatch(pathToParams(url));
|
||||
if (currentParams.device !== requestedParams.device || currentParams.deviceInstance !== requestedParams.deviceInstance) {
|
||||
dispatch(goto(url));
|
||||
}
|
||||
} else {
|
||||
dispatch(gotoLandingPage());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user