diff --git a/src/store/modules/status.js b/src/store/modules/status.js index 3d853e61..74fb6641 100644 --- a/src/store/modules/status.js +++ b/src/store/modules/status.js @@ -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 { diff --git a/src/views/statuses/index.vue b/src/views/statuses/index.vue index 0d17316f..84b88a4c 100644 --- a/src/views/statuses/index.vue +++ b/src/views/statuses/index.vue @@ -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)