Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit b1d98aa

Browse files
authored
Merge pull request #8 from HirdayGupta/solution
Fix firestore errors in room deletion
2 parents beb2f9f + cabbad4 commit b1d98aa

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

public/app.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ async function createRoom() {
8383
// Listening for remote session description below
8484
roomRef.onSnapshot(async snapshot => {
8585
const data = snapshot.data();
86-
if (!peerConnection.currentRemoteDescription && data.answer) {
86+
if (!peerConnection.currentRemoteDescription && data && data.answer) {
8787
console.log('Got remote description: ', data.answer);
8888
const rtcSessionDescription = new RTCSessionDescription(data.answer);
8989
await peerConnection.setRemoteDescription(rtcSessionDescription);
@@ -227,11 +227,11 @@ async function hangUp(e) {
227227
const roomRef = db.collection('rooms').doc(roomId);
228228
const calleeCandidates = await roomRef.collection('calleeCandidates').get();
229229
calleeCandidates.forEach(async candidate => {
230-
await candidate.delete();
230+
await candidate.ref.delete();
231231
});
232232
const callerCandidates = await roomRef.collection('callerCandidates').get();
233233
callerCandidates.forEach(async candidate => {
234-
await candidate.delete();
234+
await candidate.ref.delete();
235235
});
236236
await roomRef.delete();
237237
}

0 commit comments

Comments
 (0)