mirror of
https://github.com/trezor/trezor-wallet
synced 2024-12-29 02:18:06 +00:00
RouterService postActions
This commit is contained in:
parent
ae4b27d968
commit
e677a7580d
@ -103,7 +103,7 @@ export default class AbstractAccount<P> extends Component<Props & P, AccountStat
|
||||
} = this.state;
|
||||
|
||||
if (!device) {
|
||||
return (<section>Device with state {accountState.deviceState} not found</section>);
|
||||
return (<section><Notification className="warning" title={ `Device with state ${accountState.deviceState} not found` } /></section>);
|
||||
}
|
||||
|
||||
// account not found. checking why...
|
||||
|
@ -94,20 +94,19 @@ const RouterService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa
|
||||
|
||||
const requestedParams: RouterLocationState = pathToParams(action.payload.pathname);
|
||||
const currentParams: RouterLocationState = pathToParams(location ? location.pathname : '/');
|
||||
const postActions: Array<Action> = [];
|
||||
|
||||
let redirectPath: ?string;
|
||||
// first event after application loads
|
||||
if (!location) {
|
||||
|
||||
api.dispatch({
|
||||
postActions.push({
|
||||
type: WALLET.SET_INITIAL_URL,
|
||||
pathname: action.payload.pathname,
|
||||
state: requestedParams
|
||||
});
|
||||
|
||||
redirectPath = '/';
|
||||
|
||||
//return next(action);
|
||||
} else {
|
||||
|
||||
const isModalOpened: boolean = api.getState().modal.opened;
|
||||
@ -132,7 +131,7 @@ const RouterService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa
|
||||
} else if (requestedParams.device) {
|
||||
|
||||
if (currentParams.device !== requestedParams.device || currentParams.deviceInstance !== requestedParams.deviceInstance) {
|
||||
api.dispatch({
|
||||
postActions.push({
|
||||
type: CONNECT.SELECT_DEVICE,
|
||||
payload: {
|
||||
id: requestedParams.device,
|
||||
@ -142,7 +141,7 @@ const RouterService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa
|
||||
}
|
||||
|
||||
if (requestedParams.network !== currentParams.network) {
|
||||
api.dispatch({
|
||||
postActions.push({
|
||||
type: CONNECT.COIN_CHANGED,
|
||||
payload: {
|
||||
network: requestedParams.network
|
||||
@ -165,7 +164,17 @@ const RouterService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa
|
||||
action.payload.state = requestedParams;
|
||||
}
|
||||
|
||||
// resolve LOCATION_CHANGE action
|
||||
next(action);
|
||||
|
||||
// resolve post actions
|
||||
postActions.forEach(a => {
|
||||
api.dispatch(a);
|
||||
});
|
||||
|
||||
api.dispatch( NotificationActions.clear(currentParams, requestedParams) );
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
// Pass all actions through by default
|
||||
|
Loading…
Reference in New Issue
Block a user