Reset the chat list on logout

This commit is contained in:
eugenijm 2020-05-24 22:04:36 +03:00
parent c82436cd8a
commit 5996954c4a
2 changed files with 11 additions and 2 deletions

View file

@ -100,6 +100,10 @@ const chats = {
deleteChatMessage ({ rootState, commit, dispatch }, value) {
rootState.api.backendInteractor.deleteChatMessage(value)
commit('deleteChatMessage', { commit, ...value })
},
resetChats ({ commit, dispatch }) {
dispatch('clearCurrentChat')
commit('resetChats', { commit })
}
},
mutations: {
@ -154,8 +158,12 @@ const chats = {
state.chats.idStore = omitBy(state.chats.idStore, conversation => conversation.last_status.id === id)
},
resetChats (state, { _dispatch }) {
state.chats.data = []
state.chats.idStore = {}
state.chatList = emptyChatList()
state.chats.openedChats = {}
state.chats.openedChatMessageServices = {}
state.chats.fetcher = undefined
state.chats.chatFocused = false
state.chats.currentChatId = null
},
setChatsLoading (state, { value }) {
state.chats.loading = value

View file

@ -495,6 +495,7 @@ const users = {
store.dispatch('stopFetchingFollowRequests')
store.commit('clearNotifications')
store.commit('resetStatuses')
store.dispatch('resetChats')
})
},
loginUser (store, accessToken) {