Skip to content

Commit

Permalink
add attendees field to event documents UCMercedACM#196
Browse files Browse the repository at this point in the history
  • Loading branch information
SalihSaygi committed Feb 20, 2022
1 parent 8cd699d commit a3199e5
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 a3199e5

Please sign in to comment.