dispatch/client/js/modules/route.js

23 lines
477 B
JavaScript
Raw Normal View History

2018-12-08 10:08:01 +00:00
import { updateSelection } from 'state/tab';
2018-12-06 12:27:53 +00:00
import { observe, when } from 'utils/observe';
export default function route({ store }) {
let first = true;
when(
store,
state => state.app.initialized,
() =>
observe(
store,
state => state.router,
router => {
if (!router.route || router.route === 'chat') {
2018-12-08 10:08:01 +00:00
store.dispatch(updateSelection(first));
2018-12-06 12:27:53 +00:00
first = false;
}
}
)
);
}