diff options
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, +}; |