mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-28 03:08:30 +00:00
Update fields according to new react-router
This commit is contained in:
parent
0f9d864347
commit
786303400c
@ -36,6 +36,7 @@ const initialState: State = {
|
|||||||
export default function wallet(state: State = initialState, action: Action): State {
|
export default function wallet(state: State = initialState, action: Action): State {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case WALLET.SET_INITIAL_URL:
|
case WALLET.SET_INITIAL_URL:
|
||||||
|
console.log('action2', action);
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
initialParams: action.state,
|
initialParams: action.state,
|
||||||
|
@ -26,10 +26,10 @@ const RouterService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa
|
|||||||
// override action state (to be stored in RouterReducer)
|
// override action state (to be stored in RouterReducer)
|
||||||
const override = action;
|
const override = action;
|
||||||
override.payload.state = api.dispatch(RouterActions.pathToParams(validUrl));
|
override.payload.state = api.dispatch(RouterActions.pathToParams(validUrl));
|
||||||
const redirect = action.payload.pathname !== validUrl;
|
const redirect = action.payload.location.pathname !== validUrl;
|
||||||
if (redirect) {
|
if (redirect) {
|
||||||
// override action pathname
|
// override action pathname
|
||||||
override.payload.pathname = validUrl;
|
override.payload.location.pathname = validUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// pass action
|
// pass action
|
||||||
|
@ -34,7 +34,7 @@ const WalletService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa
|
|||||||
// TODO: validate if initial url is potentially correct
|
// TODO: validate if initial url is potentially correct
|
||||||
api.dispatch({
|
api.dispatch({
|
||||||
type: WALLET.SET_INITIAL_URL,
|
type: WALLET.SET_INITIAL_URL,
|
||||||
pathname: action.payload.pathname,
|
pathname: action.payload.location.pathname,
|
||||||
state: {},
|
state: {},
|
||||||
});
|
});
|
||||||
// pass action and break process
|
// pass action and break process
|
||||||
|
Loading…
Reference in New Issue
Block a user