diff --git a/src/components/SearchPopup.vue b/src/components/SearchPopup.vue index e90be36..bdf226b 100644 --- a/src/components/SearchPopup.vue +++ b/src/components/SearchPopup.vue @@ -10,6 +10,7 @@
+
@@ -36,7 +37,8 @@ export default { data() { return { query: '', - loading: false + loading: false, + error: '' } }, mounted () { @@ -62,9 +64,15 @@ export default { methods: { search () { this.loading = true + this.error = '' this.$store.dispatch('startQuery', this.query) - .then(() => { + .then(result => { this.loading = false + if (result.error) { + this.error = result.error + } else { + this.error = '' + } }) }, close () { diff --git a/src/store.js b/src/store.js index 63bb9a6..5b2926f 100644 --- a/src/store.js +++ b/src/store.js @@ -273,7 +273,13 @@ export default new Vuex.Store({ }) .then(response => response.json()) .then(response => { - commit('newSearchResults', response.items) + if (response.items) { + commit('newSearchResults', response.items) + return { error: false } + } else { + commit('newSearchResults', []) + return { error: response.error } + } }) }, createChannel(x, name) {