cat list: on load only autoselect cat if none already selected
This commit is contained in:
@ -60,14 +60,15 @@ export const store = new Vuex.Store({
|
||||
},
|
||||
|
||||
actions: {
|
||||
async loadMyCatalogs({ commit }) {
|
||||
async loadMyCatalogs({ commit, state }) {
|
||||
try {
|
||||
commit('setLoadingMyCatalogs', true)
|
||||
const response = await axios.get('/api/v1/catalogs/mine')
|
||||
if ('catalogs' in response.data) {
|
||||
// console.log('recieved catalogs:', response.data.catalogs)
|
||||
commit('setMyCatalogs', response.data.catalogs)
|
||||
if (response.data.catalogs.length > 0) {
|
||||
if (response.data.catalogs.length > 0 &&
|
||||
state.selectedCatalog == null) {
|
||||
commit('setSelectedCatalog', response.data.catalogs[0])
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user