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: {
|
actions: {
|
||||||
async loadMyCatalogs({ commit }) {
|
async loadMyCatalogs({ commit, state }) {
|
||||||
try {
|
try {
|
||||||
commit('setLoadingMyCatalogs', true)
|
commit('setLoadingMyCatalogs', true)
|
||||||
const response = await axios.get('/api/v1/catalogs/mine')
|
const response = await axios.get('/api/v1/catalogs/mine')
|
||||||
if ('catalogs' in response.data) {
|
if ('catalogs' in response.data) {
|
||||||
// console.log('recieved catalogs:', response.data.catalogs)
|
// console.log('recieved catalogs:', response.data.catalogs)
|
||||||
commit('setMyCatalogs', 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])
|
commit('setSelectedCatalog', response.data.catalogs[0])
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user