fix open chat functionality after relog co-authored-by: Ogerly <https://github.com/ogerly>

This commit is contained in:
Ulf Gebhardt 2023-07-11 12:13:46 +02:00
parent 073adbe48c
commit dd4e6bf2dc
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9
3 changed files with 7 additions and 4 deletions

View File

@ -37,7 +37,7 @@ describe('default.vue', () => {
getters: { getters: {
'auth/isLoggedIn': () => true, 'auth/isLoggedIn': () => true,
'chat/showChat': () => { 'chat/showChat': () => {
return { showChat: false, roomID: 'u0' } return { showChat: false, roomID: null }
}, },
}, },
}) })

View File

@ -16,7 +16,7 @@
<div v-if="$store.getters['chat/showChat'].showChat" class="chat-modul"> <div v-if="$store.getters['chat/showChat'].showChat" class="chat-modul">
<ds-text align="right" class="close"> <ds-text align="right" class="close">
RoomID: {{ $store.getters['chat/showChat'].roomID }} RoomID: {{ $store.getters['chat/showChat'].roomID }}
<ds-button @click="$store.commit('chat/SET_OPEN_CHAT', { showChat: false, roomID: 'u0' })"> <ds-button @click="$store.commit('chat/SET_OPEN_CHAT', { showChat: false, roomID: null })">
x x
</ds-button> </ds-button>
</ds-text> </ds-text>
@ -41,6 +41,9 @@ export default {
ChatModule, ChatModule,
}, },
mixins: [seo, mobile()], mixins: [seo, mobile()],
beforeCreate() {
this.$store.commit('chat/SET_OPEN_CHAT', { showChat: false, roomID: null })
},
} }
</script> </script>

View File

@ -1,14 +1,14 @@
export const state = () => { export const state = () => {
return { return {
showChat: false, showChat: false,
roomID: 'u0', roomID: null,
} }
} }
export const mutations = { export const mutations = {
SET_OPEN_CHAT(state, ctx) { SET_OPEN_CHAT(state, ctx) {
state.showChat = ctx.showChat || false state.showChat = ctx.showChat || false
state.roomID = ctx.roomID || 'u0' state.roomID = ctx.roomID || null
}, },
} }