Clear search and filter inputs when vue instance is destroyed

This commit is contained in:
Angelina Filippova 2020-05-18 22:50:32 +03:00
parent 1c2782a522
commit 20a56bb21f
2 changed files with 7 additions and 0 deletions

View file

@ -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 })

View file

@ -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'