From 6b94950e1e5e68aca394b947665091a8e5c09d7f Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Mon, 3 Feb 2020 17:43:20 +0300 Subject: [PATCH] Make instance select clearable --- src/store/modules/status.js | 18 ++++++++++-------- src/views/statuses/index.vue | 1 + 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/store/modules/status.js b/src/store/modules/status.js index b433e4b0..35e978f3 100644 --- a/src/store/modules/status.js +++ b/src/store/modules/status.js @@ -54,14 +54,16 @@ const status = { }, async FetchStatusesByInstance({ commit, getters, state }) { commit('SET_LOADING', true) - const statuses = await fetchStatusesByInstance( - { - instance: state.statusesByInstance.selectedInstance, - authHost: getters.authHost, - token: getters.token, - pageSize: state.statusesByInstance.pageSize, - page: state.statusesByInstance.page - }) + const statuses = state.statusesByInstance.selectedInstance === '' + ? { data: [] } + : await fetchStatusesByInstance( + { + instance: state.statusesByInstance.selectedInstance, + authHost: getters.authHost, + token: getters.token, + pageSize: state.statusesByInstance.pageSize, + page: state.statusesByInstance.page + }) commit('SET_STATUSES', statuses.data) commit('SET_LOADING', false) diff --git a/src/views/statuses/index.vue b/src/views/statuses/index.vue index 9639db41..c91e345e 100644 --- a/src/views/statuses/index.vue +++ b/src/views/statuses/index.vue @@ -9,6 +9,7 @@ :placeholder="$t('statuses.instanceFilter')" :no-data-text="$t('statuses.noInstances')" filterable + clearable class="select-instance" @change="handleFilterChange">