added content from /gdp/corpus
This commit is contained in:
+2
-1
@@ -1,11 +1,12 @@
|
||||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
|
||||
// https://github.com/vuejs/vuex/tree/dev/examples/shopping-cart
|
||||
import Corpus from './modules/corpus'
|
||||
|
||||
Vue.use(Vuex)
|
||||
export default new Vuex.Store({
|
||||
modules: {
|
||||
Corpus
|
||||
// search
|
||||
}
|
||||
})
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import { REST } from 'api/rest-axios'
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
|
||||
// initial state
|
||||
state: {
|
||||
items: []
|
||||
},
|
||||
|
||||
// getters
|
||||
getters: {},
|
||||
|
||||
// mutations
|
||||
mutations: {
|
||||
setItems (state, content) {
|
||||
state.items = state.items.concat(content)
|
||||
}
|
||||
},
|
||||
|
||||
// actions
|
||||
actions: {
|
||||
getItems ({ dispatch, commit, state }) {
|
||||
return REST.get(`/corpus`, {})
|
||||
.then(({ data }) => {
|
||||
console.log('corpus REST: data', data)
|
||||
commit('setItems', data.content)
|
||||
})
|
||||
.catch((error) => {
|
||||
console.warn('Issue with corpus', error)
|
||||
Promise.reject(error)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user