diff --git a/src/js/store/modules/filter/actions.js b/src/js/store/modules/filter/actions.js new file mode 100644 index 000000000..5a2ce23f2 --- /dev/null +++ b/src/js/store/modules/filter/actions.js @@ -0,0 +1,14 @@ +import axios from '../../../axios/axios'; +import qs from 'qs'; + +export const do_query = ({ commit, state }) => { + return new Promise((resolve, reject) =>{ + axios.get('/collections/' + state.collection + '/items?' + qs.stringify( state.query )) + .then(res => { + + }) + .catch(error => { + + }) + }); +} diff --git a/src/js/store/modules/filter/getters.js b/src/js/store/modules/filter/getters.js new file mode 100644 index 000000000..3d508ffd2 --- /dev/null +++ b/src/js/store/modules/filter/getters.js @@ -0,0 +1,7 @@ +export const getQuery = state => { + return state.query; +} + +export const getCollection = state => { + return state.collection; +} diff --git a/src/js/store/modules/filter/index.js b/src/js/store/modules/filter/index.js new file mode 100644 index 000000000..5f5320534 --- /dev/null +++ b/src/js/store/modules/filter/index.js @@ -0,0 +1,16 @@ +import * as actions from './actions'; +import * as getters from './getters'; +import * as mutations from './mutations'; + +const state = { + query: {}, + collection: null +}; + +export default { + namespaced: true, + state, + mutations, + actions, + getters +} \ No newline at end of file diff --git a/src/js/store/modules/filter/mutations.js b/src/js/store/modules/filter/mutations.js new file mode 100644 index 000000000..f935a50ce --- /dev/null +++ b/src/js/store/modules/filter/mutations.js @@ -0,0 +1,8 @@ +export const setQuery = ( state, query ) => { + state.query = query; +} + +export const setCollection = ( state, collection ) => { + state.query = collection; +} +