refactor: vue fixes + modal-upgrade-system.vue

This commit is contained in:
NGPixel
2017-06-10 10:41:15 -04:00
parent 5a8c5237af
commit 28fb2aee70
14 changed files with 130 additions and 68 deletions

View File

@@ -12,6 +12,7 @@ import modalCreateUser from './modules/modal-create-user'
import modalDeleteUser from './modules/modal-delete-user'
import modalDiscardPage from './modules/modal-discard-page'
import modalMovePage from './modules/modal-move-page'
import modalUpgradeSystem from './modules/modal-upgrade-system'
import pageLoader from './modules/page-loader'
Vue.use(Vuex)
@@ -40,6 +41,7 @@ export default new Vuex.Store({
modalDeleteUser,
modalDiscardPage,
modalMovePage,
modalUpgradeSystem,
pageLoader
}
})

View File

@@ -1,6 +1,7 @@
'use strict'
export default {
namespaced: true,
state: {
shown: false,
hash: ''
@@ -13,10 +14,11 @@ export default {
}
},
actions: {
anchorOpen({ commit, dispatch }, hash) {
open({ commit }, hash) {
console.info('MIGUEL!')
commit('anchorChange', { shown: true, hash })
},
anchorClose({ commit, dispatch }) {
close({ commit }) {
commit('anchorChange', { shown: false })
}
}

View File

@@ -0,0 +1,24 @@
'use strict'
export default {
namespaced: true,
state: {
shown: false,
mode: 'upgrade',
step: 'confirm'
},
getters: {},
mutations: {
shownChange: (state, shownState) => { state.shown = shownState },
modeChange: (state, modeState) => { state.mode = modeState },
stepChange: (state, stepState) => { state.step = stepState }
},
actions: {
open({ commit }, opts) {
commit('shownChange', true)
commit('modeChange', opts.mode)
commit('stepChange', 'confirm')
},
close({ commit }) { commit('shownChange', false) }
}
}