diff options
author | Simon Knox <psimyn@gmail.com> | 2018-03-26 12:21:01 +1100 |
---|---|---|
committer | Simon Knox <psimyn@gmail.com> | 2018-03-26 12:21:01 +1100 |
commit | 24cc3e88d506ef9530615d9bc61307d318411a23 (patch) | |
tree | d3de2185a39e4acb0ce3d577fefe1ba8b8304805 /app/assets/javascripts/notes | |
parent | 63e427ac3bcf9a7bf0dc9e3ee840427d2bd4b59c (diff) | |
download | gitlab-ce-vuex_note_modules.tar.gz |
fix Vuex module structre for diffs and notesvuex_note_modules
match directory structure described in Vuex docs
Diffstat (limited to 'app/assets/javascripts/notes')
-rw-r--r-- | app/assets/javascripts/notes/index.js | 11 | ||||
-rw-r--r-- | app/assets/javascripts/notes/stores/index.js | 21 | ||||
-rw-r--r-- | app/assets/javascripts/notes/stores/modules/index.js | 22 |
3 files changed, 30 insertions, 24 deletions
diff --git a/app/assets/javascripts/notes/index.js b/app/assets/javascripts/notes/index.js index 66897e6a0db..aa100577fbe 100644 --- a/app/assets/javascripts/notes/index.js +++ b/app/assets/javascripts/notes/index.js @@ -1,15 +1,6 @@ import Vue from 'vue'; -import Vuex from 'vuex'; import notesApp from './components/notes_app.vue'; -import storeConfig from './stores'; - -Vue.use(Vuex); - -const store = new Vuex.Store({ - modules: { - notes: storeConfig, - }, -}); +import store from './stores'; document.addEventListener( 'DOMContentLoaded', diff --git a/app/assets/javascripts/notes/stores/index.js b/app/assets/javascripts/notes/stores/index.js index f9805bc4d1e..1ed641a327e 100644 --- a/app/assets/javascripts/notes/stores/index.js +++ b/app/assets/javascripts/notes/stores/index.js @@ -1,22 +1,15 @@ +import Vue from 'vue'; +import Vuex from 'vuex'; import * as actions from './actions'; import * as getters from './getters'; import mutations from './mutations'; +import module from './modules'; -export default { - state: { - notes: [], - targetNoteHash: null, - lastFetchedAt: null, +Vue.use(Vuex); - // View layer - isToggleStateButtonLoading: false, - - // holds endpoints and permissions provided through haml - notesData: {}, - userData: {}, - noteableData: {}, - }, +export default new Vuex.Store({ + state: module.state, actions, getters, mutations, -}; +}); diff --git a/app/assets/javascripts/notes/stores/modules/index.js b/app/assets/javascripts/notes/stores/modules/index.js new file mode 100644 index 00000000000..0bbcb0e3615 --- /dev/null +++ b/app/assets/javascripts/notes/stores/modules/index.js @@ -0,0 +1,22 @@ +import * as actions from '../actions'; +import * as getters from '../getters'; +import mutations from '../mutations'; + +export default { + state: { + notes: [], + targetNoteHash: null, + lastFetchedAt: null, + + // View layer + isToggleStateButtonLoading: false, + + // holds endpoints and permissions provided through haml + notesData: {}, + userData: {}, + noteableData: {}, + }, + actions, + getters, + mutations, +}; |