refactored user blocks using ajax loaded drupal's html as template for vue
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
<script>
|
||||
import SearchForm from 'vuejs/components/Form/SearchForm'
|
||||
import { mapState, mapActions } from 'vuex'
|
||||
import { MSAPI } from 'vuejs/api/msapi-axios'
|
||||
import { MA } from 'vuejs/api/ma-axios'
|
||||
|
||||
export default {
|
||||
props: ['blockid', 'formhtml'],
|
||||
@@ -23,17 +23,17 @@ export default {
|
||||
canSearch: state => state.User.canSearch
|
||||
}),
|
||||
displayform(){
|
||||
console.log('computed displayform');
|
||||
// console.log('computed displayform');
|
||||
return this.canSearch && this.form
|
||||
}
|
||||
},
|
||||
beforeMount() {
|
||||
console.log('SearchBlock beforeMount');
|
||||
// console.log('SearchBlock beforeMount');
|
||||
this.form = this.formhtml
|
||||
},
|
||||
watch: {
|
||||
canSearch(new_value, old_value) {
|
||||
console.log('canSearch changed, old: '+old_value+", new: "+new_value);
|
||||
// console.log('canSearch changed, old: '+old_value+", new: "+new_value);
|
||||
if(new_value && !this.form){
|
||||
this.getSearchForm()
|
||||
}
|
||||
@@ -44,9 +44,9 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getSearchForm(){
|
||||
MSAPI.get(`/search_form`)
|
||||
MA.get(`/materio_sapi/search_form`)
|
||||
.then(({data}) => {
|
||||
console.log("getSearchForm");
|
||||
// console.log("getSearchForm");
|
||||
this.form = data.rendered
|
||||
})
|
||||
.catch(( error ) => {
|
||||
|
Reference in New Issue
Block a user