Only connect to chat when authenticating in the first place
To avoid duplication of the connection, the chat socket is destroyed upon logging out.
This commit is contained in:
parent
a67881b096
commit
e618c6ffb0
4 changed files with 15 additions and 5 deletions
|
@ -292,6 +292,7 @@ const users = {
|
|||
|
||||
logout (store) {
|
||||
store.commit('clearCurrentUser')
|
||||
store.dispatch('disconnectFromChat')
|
||||
store.commit('setToken', false)
|
||||
store.dispatch('stopFetching', 'friends')
|
||||
store.commit('setBackendInteractor', backendInteractorService())
|
||||
|
@ -321,6 +322,9 @@ const users = {
|
|||
|
||||
if (user.token) {
|
||||
store.dispatch('setWsToken', user.token)
|
||||
|
||||
// Initialize the chat socket.
|
||||
store.dispatch('initializeSocket')
|
||||
}
|
||||
|
||||
// Start getting fresh posts.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue