populating search form filters value from url query params
This commit is contained in:
@ -7,6 +7,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import qs from 'querystring-es3'
|
||||
|
||||
import SearchForm from 'vuejs/components/Form/SearchForm'
|
||||
import { mapState, mapActions } from 'vuex'
|
||||
import MA from 'vuejs/api/ma-axios'
|
||||
@ -20,7 +22,10 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
canSearch: state => state.User.canSearch
|
||||
canSearch: state => state.User.canSearch,
|
||||
keys: state => state.Search.keys,
|
||||
term: state => state.Search.term,
|
||||
filters: state => state.Search.filters
|
||||
}),
|
||||
displayform(){
|
||||
// console.log('computed displayform')
|
||||
@ -44,7 +49,17 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getSearchForm(){
|
||||
MA.get(`/materio_sapi/search_form`)
|
||||
console.log('getSearchForm')
|
||||
// var urlParams = new URLSearchParams(window.location.search);
|
||||
// var urlParamsKeys = urlParams.keys()
|
||||
const params = {
|
||||
keys: this.keys,
|
||||
term: this.term,
|
||||
filters: this.filters
|
||||
}
|
||||
console.log('Search getSearchForm params', params)
|
||||
const q = qs.stringify(params)
|
||||
MA.get(`/materio_sapi/search_form?`+q)
|
||||
.then(({data}) => {
|
||||
// console.log('getSearchForm')
|
||||
this.form = data.rendered
|
||||
|
Reference in New Issue
Block a user