diff --git a/cateditor/src/pages/list/store/index.js b/cateditor/src/pages/list/store/index.js index 5f19f48..eef71e0 100644 --- a/cateditor/src/pages/list/store/index.js +++ b/cateditor/src/pages/list/store/index.js @@ -31,16 +31,6 @@ export const store = new Vuex.Store({ getSelectedCatalog(state) { return state.selectedCatalog }, - // findCatalog(state) { - // return function(id) { - // let cat = state.myCatalogs.find(c => c.id === id) - // if (cat !== undefined) { - // return cat - // } else { - // return state.publicCatalogs.find(c => c.id === id) - // } - // } - // }, findCatalog: (state) => (id) => { let cat = state.myCatalogs.find(c => c.id === id) if (cat !== undefined) { @@ -49,9 +39,6 @@ export const store = new Vuex.Store({ return state.publicCatalogs.find(c => c.id === id) } }, - // CAT_SECTION: (state) => (id) => { - // return state.catalog.sections.find(s => s.id === id) - // }, }, mutations: { @@ -80,6 +67,9 @@ export const store = new Vuex.Store({ if ('catalogs' in response.data) { // console.log('recieved catalogs:', response.data.catalogs) commit('setMyCatalogs', response.data.catalogs) + if (response.data.catalogs.length > 0) { + commit('setSelectedCatalog', response.data.catalogs[0]) + } } else { // console.log('no catalogs') commit('setMyCatalogs', [])