added content from /gdp/corpus

This commit is contained in:
2019-08-21 11:54:20 +02:00
parent 5ddfb7d286
commit 157f964783
4 changed files with 108 additions and 23 deletions
+2 -1
View File
@@ -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
}
})
+35
View File
@@ -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)
})
}
}
}