From 20a56bb21f9acc8ae5411130c7985efe28e588bb Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Mon, 18 May 2020 22:50:32 +0300 Subject: [PATCH] Clear search and filter inputs when vue instance is destroyed --- src/store/modules/users.js | 4 ++++ src/views/users/index.vue | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/store/modules/users.js b/src/store/modules/users.js index 0b6061cb..76a844bb 100644 --- a/src/store/modules/users.js +++ b/src/store/modules/users.js @@ -124,6 +124,10 @@ const users = { dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId }) }, + ClearUsersState({ commit }) { + commit('SET_SEARCH_QUERY', '') + commit('SET_USERS_FILTERS', { local: false, external: false, active: false, deactivated: false }) + }, async ClearFilters({ commit, dispatch, state }) { commit('CLEAR_USERS_FILTERS') dispatch('SearchUsers', { query: state.searchQuery, page: 1 }) diff --git a/src/views/users/index.vue b/src/views/users/index.vue index d3edbf5b..56df8612 100644 --- a/src/views/users/index.vue +++ b/src/views/users/index.vue @@ -179,6 +179,9 @@ export default { this.$store.dispatch('NeedReboot') this.$store.dispatch('FetchUsers', { page: 1 }) }, + destroyed() { + this.$store.dispatch('ClearUsersState') + }, methods: { activationIcon(status) { return status ? 'el-icon-error' : 'el-icon-success'