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

Commit

Permalink
Merge pull request #8 from HirdayGupta/solution
Browse files Browse the repository at this point in the history
Fix firestore errors in room deletion
  • Loading branch information
ErikHellman authored Mar 30, 2020
2 parents beb2f9f + cabbad4 commit b1d98aa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ async function createRoom() {
// Listening for remote session description below
roomRef.onSnapshot(async snapshot => {
const data = snapshot.data();
if (!peerConnection.currentRemoteDescription && data.answer) {
if (!peerConnection.currentRemoteDescription && data && data.answer) {
console.log('Got remote description: ', data.answer);
const rtcSessionDescription = new RTCSessionDescription(data.answer);
await peerConnection.setRemoteDescription(rtcSessionDescription);
Expand Down Expand Up @@ -227,11 +227,11 @@ async function hangUp(e) {
const roomRef = db.collection('rooms').doc(roomId);
const calleeCandidates = await roomRef.collection('calleeCandidates').get();
calleeCandidates.forEach(async candidate => {
await candidate.delete();
await candidate.ref.delete();
});
const callerCandidates = await roomRef.collection('callerCandidates').get();
callerCandidates.forEach(async candidate => {
await candidate.delete();
await candidate.ref.delete();
});
await roomRef.delete();
}
Expand Down

0 comments on commit b1d98aa

Please sign in to comment.