forked from AkkomaGang/admin-fe
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')
|
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 }) {
|
async DeleteStatus({ dispatch, getters }, { statusId, reportCurrentPage, userId, godmode, fetchStatusesByInstance }) {
|
||||||
await deleteStatus(statusId, getters.authHost, getters.token)
|
await deleteStatus(statusId, getters.authHost, getters.token)
|
||||||
if (reportCurrentPage !== 0) { // called from Reports
|
if (reportCurrentPage !== 0) { // called from Reports
|
||||||
|
@ -74,10 +82,9 @@ const status = {
|
||||||
commit('SET_STATUS_VISIBILITY', data.status_visibility)
|
commit('SET_STATUS_VISIBILITY', data.status_visibility)
|
||||||
commit('SET_LOADING', false)
|
commit('SET_LOADING', false)
|
||||||
},
|
},
|
||||||
async FetchStatusesByInstance({ commit, getters, state, rootState }) {
|
async FetchStatusesByInstance({ commit, dispatch, getters, state, rootState }) {
|
||||||
const { data } = await fetchStatusesCount(state.statusesByInstance.selectedInstance, getters.authHost, getters.token)
|
|
||||||
commit('SET_STATUS_VISIBILITY', data.status_visibility)
|
|
||||||
commit('SET_LOADING', true)
|
commit('SET_LOADING', true)
|
||||||
|
dispatch('FetchStatusesCount', state.statusesByInstance.selectedInstance)
|
||||||
if (state.statusesByInstance.selectedInstance === '') {
|
if (state.statusesByInstance.selectedInstance === '') {
|
||||||
commit('SET_STATUSES_BY_INSTANCE', [])
|
commit('SET_STATUSES_BY_INSTANCE', [])
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -142,6 +142,9 @@ export default {
|
||||||
this.$store.dispatch('FetchPeers')
|
this.$store.dispatch('FetchPeers')
|
||||||
this.$store.dispatch('FetchStatusesCount')
|
this.$store.dispatch('FetchStatusesCount')
|
||||||
},
|
},
|
||||||
|
destroyed() {
|
||||||
|
this.$store.dispatch('ClearState')
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleFilterChange() {
|
handleFilterChange() {
|
||||||
this.$store.dispatch('HandlePageChange', 1)
|
this.$store.dispatch('HandlePageChange', 1)
|
||||||
|
|
Loading…
Reference in a new issue