editor store: cleanup
This commit is contained in:
@ -21,7 +21,7 @@ export const store = new Vuex.Store({
|
||||
|
||||
// NOTE don't use if you're not doing anything interesting, just use state.
|
||||
|
||||
material: (state) => (id) => {
|
||||
material: state => id => {
|
||||
return state.materials[id]
|
||||
},
|
||||
|
||||
@ -33,7 +33,7 @@ export const store = new Vuex.Store({
|
||||
}
|
||||
},
|
||||
|
||||
section: (state) => (id) => {
|
||||
section: state => id => {
|
||||
if (state.catalog && id) {
|
||||
return state.catalog.sections.find(s => s.id === id)
|
||||
} else {
|
||||
@ -104,20 +104,6 @@ export const store = new Vuex.Store({
|
||||
return getters.material(state.selectedMaterialID)
|
||||
},
|
||||
|
||||
/// OLD STUFF
|
||||
//
|
||||
// catalog info
|
||||
//
|
||||
// CAT_NAME: state => {
|
||||
// return state.catalog.name
|
||||
// },
|
||||
// CAT_SECTIONS: state => {
|
||||
// return state.catalog.sections
|
||||
// },
|
||||
// CAT_SECTION: (state) => (id) => {
|
||||
// return state.catalog.sections.find(s => s.id === id)
|
||||
// },
|
||||
|
||||
catalogSections: state => {
|
||||
if (state.catalog != null) {
|
||||
return state.catalog.sections
|
||||
@ -126,7 +112,7 @@ export const store = new Vuex.Store({
|
||||
}
|
||||
},
|
||||
|
||||
catalogProperty: (state) => (key) => {
|
||||
catalogProperty: state => key => {
|
||||
if (state.catalog != null) {
|
||||
return state.catalog[key]
|
||||
} else {
|
||||
@ -137,27 +123,6 @@ export const store = new Vuex.Store({
|
||||
//
|
||||
// selection info
|
||||
//
|
||||
// SELECTED_SECTION_ID: state => {
|
||||
// return state.selectedSectionID
|
||||
// },
|
||||
// SELECTED_SECTION: state => {
|
||||
// return store.getters.CAT_SECTION(state.selectedSectionID)
|
||||
// },
|
||||
// SELECTED_FAMILY_ID: state => {
|
||||
// return state.selectedFamilyID
|
||||
// },
|
||||
// SELECTED_MODEL_ID: state => {
|
||||
// return state.selectedModelID
|
||||
// },
|
||||
// SELECTED_MATERIAL_ID: state => {
|
||||
// return state.selectedMaterial
|
||||
// },
|
||||
//
|
||||
// material info
|
||||
//
|
||||
// MATERIAL: (state) => (id) => {
|
||||
// return state.materials[id]
|
||||
// },
|
||||
|
||||
loadingCatalog(state) {
|
||||
return state.loadingCatalog
|
||||
@ -231,33 +196,6 @@ export const store = new Vuex.Store({
|
||||
}
|
||||
},
|
||||
|
||||
// SET_CAT_SECTIONS: (state, payload) => {
|
||||
// state.catalog.sections = payload
|
||||
// },
|
||||
// SET_CAT_SECTION_NAME: (state, payload) => {
|
||||
// var section = state.catalog.sections.find(s => s.id === payload.id)
|
||||
// section.name = payload.name
|
||||
// },
|
||||
// SET_SELECTED_SECTION_ID: (state, payload) => {
|
||||
// state.selectedSectionID = payload
|
||||
// state.selectedFamilyID = null
|
||||
// state.selectedModelID = null
|
||||
// state.selectedMaterial = null
|
||||
// },
|
||||
// SET_SELECTED_FAMILY_ID: (state, payload) => {
|
||||
// state.selectedFamilyID = payload
|
||||
// state.selectedModelID = null
|
||||
// state.selectedMaterial = null
|
||||
// },
|
||||
// SET_SELECTED_MODEL_ID: (state, payload) => {
|
||||
// state.selectedModelID = payload
|
||||
// state.selectedFamilyID = null
|
||||
// state.selectedMaterial = null
|
||||
// },
|
||||
// SET_SELECTED_MATERIAL_ID: (state, payload) => {
|
||||
// state.selectedMaterial = payload
|
||||
// },
|
||||
|
||||
addMaterialsToLibrary(state, materials) {
|
||||
console.log('adding', materials.length, 'materials')
|
||||
let map = {}
|
||||
@ -472,28 +410,6 @@ export const store = new Vuex.Store({
|
||||
commit('setSectionPages', { section: foundSection, pages: pages })
|
||||
},
|
||||
|
||||
// SET_CAT_SECTIONS: (context, payload) => {
|
||||
// context.commit('SET_CAT_SECTIONS', payload)
|
||||
// },
|
||||
// SET_CAT_SECTION_NAME: (context, payload) => {
|
||||
// context.commit('SET_CAT_SECTION_NAME', payload)
|
||||
// },
|
||||
// SET_SELECTED_SECTION_ID: (context, payload) => {
|
||||
// context.commit('SET_SELECTED_SECTION_ID', payload)
|
||||
// },
|
||||
// SET_SELECTED_FAMILY_ID: (context, payload) => {
|
||||
// context.commit('SET_SELECTED_FAMILY_ID', payload)
|
||||
// },
|
||||
// SET_SELECTED_MODEL_ID: (context, payload) => {
|
||||
// context.commit('SET_SELECTED_MODEL_ID', payload)
|
||||
// },
|
||||
// SET_SELECTED_MATERIAL_ID: (context, payload) => {
|
||||
// context.commit('SET_SELECTED_MATERIAL_ID', payload)
|
||||
// },
|
||||
// SAVE_TODO : async (context,payload) => {
|
||||
// let { data } = await Axios.post('http://yourwebsite.com/api/todo')
|
||||
// context.commit('ADD_TODO',payload)
|
||||
// },
|
||||
deleteModelMaterial({ commit, getters }, { section, model, material }) {
|
||||
let mats = model.ids.filter(id => id !== material.id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user