Separated user and auth stores

This commit is contained in:
Jori Lallo
2017-05-29 19:08:03 -07:00
parent 98a5283e27
commit 0d87d6abf5
12 changed files with 191 additions and 143 deletions

View File

@@ -1,5 +1,5 @@
// @flow
import { observable, action, computed } from 'mobx';
import { observable, action, computed, autorunAsync } from 'mobx';
const UI_STORE = 'UI_STORE';
@@ -24,8 +24,11 @@ class UiStore {
// Rehydrate
const data = JSON.parse(localStorage.getItem(UI_STORE) || '{}');
this.sidebar = data.sidebar;
autorunAsync(() => {
localStorage.setItem(UI_STORE, this.asJson);
});
}
}
export default UiStore;
export { UI_STORE };