Redirect to stored tab if the route is not found

This commit is contained in:
Ken-Håvard Lieng 2017-05-19 08:36:13 +02:00
parent 2afbf2359c
commit 5487ecdb57
5 changed files with 62 additions and 19 deletions

View file

@ -0,0 +1,15 @@
import debounce from 'lodash/debounce';
import observe from '../util/observe';
import { getSelectedTab } from '../reducers/tab';
const saveTab = debounce(tab => {
localStorage.tab = JSON.stringify(tab);
}, 3000);
export default function storage({ store }) {
observe(store, getSelectedTab, tab => {
if (tab.server) {
saveTab(tab);
}
});
}