Skip to content

Commit db24555

Browse files
committed
Update the session and the call flag when force joining
Signed-off-by: Joas Schilling <[email protected]>
1 parent 0c729f0 commit db24555

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/services/participantsService.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
import { EventBus } from './EventBus'
3434
import SessionStorage from './SessionStorage'
3535
import { PARTICIPANT } from '../constants'
36+
import store from '../store/index'
3637

3738
/**
3839
* Joins the current user to a conversation specified with
@@ -53,6 +54,12 @@ const joinConversation = async(token) => {
5354
await signalingJoinConversation(token, response.data.ocs.data.sessionId)
5455
SessionStorage.setItem('joined_conversation', token)
5556
EventBus.$emit('joinedConversation')
57+
store.dispatch('updateSessionId', {
58+
token: token,
59+
participantIdentifier: store.getters.getParticipantIdentifier(),
60+
sessionId: response.data.ocs.data.sessionId,
61+
})
62+
store.dispatch('setCurrentParticipant', response.data.ocs.data)
5663
return response
5764
} catch (error) {
5865
if (error.response.status === 409) {

src/store/participantsStore.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,20 @@ const actions = {
205205
commit('purgeParticipantsStore', token)
206206
},
207207

208+
updateSessionId({ commit, getters }, { token, participantIdentifier, sessionId }) {
209+
const index = getters.getParticipantIndex(token, participantIdentifier)
210+
if (index === -1) {
211+
console.error('Participant not found', participantIdentifier)
212+
return
213+
}
214+
215+
const updatedData = {
216+
sessionId: sessionId,
217+
inCall: PARTICIPANT.CALL_FLAG.DISCONNECTED,
218+
}
219+
commit('updateParticipant', { token, index, updatedData })
220+
},
221+
208222
async joinCall({ commit, getters }, { token, participantIdentifier, flags }) {
209223
const index = getters.getParticipantIndex(token, participantIdentifier)
210224
if (index === -1) {

0 commit comments

Comments
 (0)