mirror of
https://github.com/trezor/trezor-wallet
synced 2025-02-10 23:22:40 +00:00
Fixed loop redirect
This commit is contained in:
parent
613302fb23
commit
0802d7d654
@ -85,7 +85,7 @@ const RouterService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa
|
|||||||
__unloading = true;
|
__unloading = true;
|
||||||
} else if (action.type === LOCATION_CHANGE && !__unloading) {
|
} else if (action.type === LOCATION_CHANGE && !__unloading) {
|
||||||
const { location } = api.getState().router;
|
const { location } = api.getState().router;
|
||||||
const web3 = api.getState().web3;
|
const { web3 } = api.getState();
|
||||||
const { devices } = api.getState();
|
const { devices } = api.getState();
|
||||||
const { error } = api.getState().connect;
|
const { error } = api.getState().connect;
|
||||||
|
|
||||||
@ -123,9 +123,8 @@ const RouterService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa
|
|||||||
// PATH VALIDATION
|
// PATH VALIDATION
|
||||||
// redirect from root view
|
// redirect from root view
|
||||||
if (action.payload.pathname === '/' || !validation(api, requestedParams)) {
|
if (action.payload.pathname === '/' || !validation(api, requestedParams)) {
|
||||||
// TODO: switch to first device?
|
// TODO redirect to first device
|
||||||
// redirectPath = `/device/${ devices[0].path }`;
|
redirectPath = '/device/x';
|
||||||
redirectPath = location.pathname;
|
|
||||||
} else if (requestedParams.device) {
|
} else if (requestedParams.device) {
|
||||||
if (requestedParams.network !== currentParams.network) {
|
if (requestedParams.network !== currentParams.network) {
|
||||||
postActions.push({
|
postActions.push({
|
||||||
@ -146,7 +145,7 @@ const RouterService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa
|
|||||||
action.payload.state = pathToParams(url);
|
action.payload.state = pathToParams(url);
|
||||||
action.payload.pathname = url;
|
action.payload.pathname = url;
|
||||||
// change url
|
// change url
|
||||||
api.dispatch(replace(url));
|
// api.dispatch(replace(url));
|
||||||
} else {
|
} else {
|
||||||
action.payload.state = requestedParams;
|
action.payload.state = requestedParams;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user