Clear state after vue instance was destroyed
This commit is contained in:
parent
8e7eb99f1f
commit
8d1d9940c9
2 changed files with 13 additions and 3 deletions
|
@ -58,6 +58,14 @@ const status = {
|
|||
dispatch('FetchStatusesByInstance')
|
||||
}
|
||||
},
|
||||
ClearState({ commit }) {
|
||||
commit('CHANGE_SELECTED_INSTANCE', '')
|
||||
commit('SET_STATUSES_BY_INSTANCE', [])
|
||||
commit('CHANGE_LOCAL_CHECKBOX_VALUE', false)
|
||||
commit('CHANGE_GODMODE_CHECKBOX_VALUE', false)
|
||||
commit('SET_ALL_LOADED', false)
|
||||
commit('CHANGE_PAGE', 1)
|
||||
},
|
||||
async DeleteStatus({ dispatch, getters }, { statusId, reportCurrentPage, userId, godmode, fetchStatusesByInstance }) {
|
||||
await deleteStatus(statusId, getters.authHost, getters.token)
|
||||
if (reportCurrentPage !== 0) { // called from Reports
|
||||
|
@ -74,10 +82,9 @@ const status = {
|
|||
commit('SET_STATUS_VISIBILITY', data.status_visibility)
|
||||
commit('SET_LOADING', false)
|
||||
},
|
||||
async FetchStatusesByInstance({ commit, getters, state, rootState }) {
|
||||
const { data } = await fetchStatusesCount(state.statusesByInstance.selectedInstance, getters.authHost, getters.token)
|
||||
commit('SET_STATUS_VISIBILITY', data.status_visibility)
|
||||
async FetchStatusesByInstance({ commit, dispatch, getters, state, rootState }) {
|
||||
commit('SET_LOADING', true)
|
||||
dispatch('FetchStatusesCount', state.statusesByInstance.selectedInstance)
|
||||
if (state.statusesByInstance.selectedInstance === '') {
|
||||
commit('SET_STATUSES_BY_INSTANCE', [])
|
||||
} else {
|
||||
|
|
|
@ -142,6 +142,9 @@ export default {
|
|||
this.$store.dispatch('FetchPeers')
|
||||
this.$store.dispatch('FetchStatusesCount')
|
||||
},
|
||||
destroyed() {
|
||||
this.$store.dispatch('ClearState')
|
||||
},
|
||||
methods: {
|
||||
handleFilterChange() {
|
||||
this.$store.dispatch('HandlePageChange', 1)
|
||||
|
|
Loading…
Reference in a new issue