implement "new catalog" in editor
This commit is contained in:
@ -78,7 +78,7 @@ export const store = new Vuex.Store({
|
||||
selectedFamilyID: null,
|
||||
selectedModelID: null,
|
||||
selectedMaterial: null,
|
||||
loadingCatalog: true,
|
||||
loadingCatalog: false,
|
||||
savingCatalog: false,
|
||||
},
|
||||
getters: {
|
||||
@ -212,6 +212,10 @@ export const store = new Vuex.Store({
|
||||
context.commit('setCatalogProperty', data)
|
||||
},
|
||||
|
||||
newCatalog({ commit }) {
|
||||
commit('setCatalog', {})
|
||||
},
|
||||
|
||||
async loadCatalog({ commit }, id) {
|
||||
try {
|
||||
commit('setLoadingCatalog', true)
|
||||
@ -219,18 +223,15 @@ export const store = new Vuex.Store({
|
||||
if (response.data) {
|
||||
console.log('recieved catalog:', response.data)
|
||||
commit('setCatalog', response.data)
|
||||
commit('setCatalogID', id)
|
||||
} else {
|
||||
console.log('no catalog')
|
||||
commit('setCatalog', null)
|
||||
commit('setCatalogID', null)
|
||||
}
|
||||
commit('setLoadingCatalog', false)
|
||||
} catch (error) {
|
||||
// TODO set loading error property
|
||||
console.error('error loading catalog: ', error)
|
||||
commit('setCatalog', null)
|
||||
commit('setCatalogID', null)
|
||||
commit('setLoadingCatalog', false)
|
||||
}
|
||||
},
|
||||
@ -244,11 +245,9 @@ export const store = new Vuex.Store({
|
||||
if (response.data) {
|
||||
console.log('recieved catalog:', response.data)
|
||||
commit('setCatalog', response.data)
|
||||
commit('setCatalogID', response.data.id)
|
||||
} else {
|
||||
console.error('no catalog returned from save!')
|
||||
commit('setCatalog', null)
|
||||
commit('setCatalogID', null)
|
||||
}
|
||||
commit('setSavingCatalog', false)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user