|
@@ -18,6 +18,10 @@ const DEFAULT: WorkspaceState = {
|
|
|
projectList: [],
|
|
projectList: [],
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+const FROM_LOCAL_STORAGE = JSON.parse(localStorage.getItem('workspace') || '{}');
|
|
|
|
|
+
|
|
|
|
|
+const INIT = Object.keys(FROM_LOCAL_STORAGE).length > 0 ? FROM_LOCAL_STORAGE : DEFAULT;
|
|
|
|
|
+
|
|
|
const actions: ActionTree<WorkspaceState, RootState> = {
|
|
const actions: ActionTree<WorkspaceState, RootState> = {
|
|
|
async refreshProjectList({ commit }) {
|
|
async refreshProjectList({ commit }) {
|
|
|
const projectList = (await ProjectAPI.getProjectListByUserId()) || [];
|
|
const projectList = (await ProjectAPI.getProjectListByUserId()) || [];
|
|
@@ -74,7 +78,7 @@ const getters: GetterTree<WorkspaceState, RootState> = {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
export const workspace: Module<WorkspaceState, RootState> = {
|
|
export const workspace: Module<WorkspaceState, RootState> = {
|
|
|
- state: () => DEFAULT,
|
|
|
|
|
|
|
+ state: () => INIT,
|
|
|
actions,
|
|
actions,
|
|
|
mutations,
|
|
mutations,
|
|
|
getters,
|
|
getters,
|