Skip to content

Commit

Permalink
Merge pull request #199 from SalihSaygi/react
Browse files Browse the repository at this point in the history
add attendees field to event documents #196
  • Loading branch information
SalihSaygi authored Feb 20, 2022
2 parents bdb1ef3 + a3199e5 commit 19bb861
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions react/acm-chapter-website/src/scripts/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import {
doc,
getDoc,
collection,
onSnapshot,
updateDoc,
getDocFromCache,
getDocs,
arrayUnion,
} from "firebase/firestore";
import { db } from "../firebase/config";

Expand Down Expand Up @@ -76,6 +75,16 @@ async function attendEvent(user, joinedEventCode) {
});
console.log("eventsAttended updated successfully");
}
const eventRef = doc(db, "events", joinedEventID);
updateDoc(eventRef, {
attendees: arrayUnion(
user.currentUser.email.substring(
0,
user.currentUser.email.indexOf("@")
)
),
});
console.log("event attendees are updated");
}
}

Expand Down

0 comments on commit 19bb861

Please sign in to comment.