search: add "is-loading" class to button

This commit is contained in:
Peter Stuifzand 2021-06-05 19:55:52 +02:00
parent 020e901474
commit c73efe8610
2 changed files with 12 additions and 6 deletions

View File

@ -35,7 +35,8 @@ export default {
props: ['is-open'],
data() {
return {
query: ''
query: '',
loading: false
}
},
mounted () {
@ -60,7 +61,11 @@ export default {
},
methods: {
search () {
this.loading = true
this.$store.dispatch('startQuery', this.query)
.then(() => {
this.loading = false
})
},
close () {
this.$store.dispatch('closeSearch')

View File

@ -265,15 +265,16 @@ export default new Vuex.Store({
if (state.channel.uid !== null) {
channel = state.channel.uid
}
fetch(this.state.microsubEndpoint + '?action=search&channel='+channel+'&query='+query, {
return fetch(this.state.microsubEndpoint + '?action=search&channel='+channel+'&query='+query, {
headers: {
'Authorization': 'Bearer ' + this.state.access_token
},
method: 'POST'
}).then(response => response.json())
.then(response => {
commit('newSearchResults', response.items)
})
})
.then(response => response.json())
.then(response => {
commit('newSearchResults', response.items)
})
},
createChannel(x, name) {
let url = this.state.microsubEndpoint + '?action=channels&name=' + encodeURIComponent(name)