Redirect to stored tab if the route is not found
This commit is contained in:
parent
2afbf2359c
commit
5487ecdb57
5 changed files with 62 additions and 19 deletions
15
client/src/js/modules/storage.js
Normal file
15
client/src/js/modules/storage.js
Normal 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);
|
||||
}
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue