-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ben Sanderson
committed
Oct 23, 2024
1 parent
56178e6
commit 4585a99
Showing
8 changed files
with
159 additions
and
26 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"dependencies": { | ||
"fetch": "^1.1.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { initializeApp } from "https://www.gstatic.com/firebasejs/10.13.2/firebase-app.js"; | ||
import { getAnalytics } from "https://www.gstatic.com/firebasejs/10.13.2/firebase-analytics.js"; | ||
import { getFirestore, collection, getDoc, getDocs, doc, query, where } from 'https://www.gstatic.com/firebasejs/10.13.2/firebase-firestore.js'; | ||
import { getAuth, | ||
createUserWithEmailAndPassword, | ||
signOut, | ||
signInWithEmailAndPassword, | ||
onAuthStateChanged | ||
} | ||
|
||
from "https://www.gstatic.com/firebasejs/10.13.2/firebase-auth.js"; | ||
// TODO: Add SDKs for Firebase products that you want to use | ||
// https://firebase.google.com/docs/web/setup#available-libraries | ||
|
||
// Your web app's Firebase configuration | ||
// For Firebase JS SDK v7.20.0 and later, measurementId is optional | ||
const firebaseConfig = { | ||
apiKey: "AIzaSyAt-SInlPaL2FzwtXrRltIEiV5l8k5HMjg", | ||
authDomain: "pageturners-a831a.firebaseapp.com", | ||
projectId: "pageturners-a831a", | ||
storageBucket: "pageturners-a831a.appspot.com", | ||
messagingSenderId: "304224952392", | ||
appId: "1:304224952392:web:f33dbc84b481e39a44787d", | ||
measurementId: "G-C6DKQSJ1R8" | ||
}; | ||
|
||
// Initialize Firebase | ||
const app = initializeApp(firebaseConfig); | ||
const analytics = getAnalytics(app); | ||
const auth = getAuth(); | ||
const db = getFirestore(app); | ||
|
||
const queryParams = new URLSearchParams(window.location.search); | ||
|
||
const name = queryParams.get("name"); | ||
|
||
|
||
async function getClubDocFromQParams(queryParams) | ||
{ | ||
const q = query(collection(db, "BookClubs"), where("BookClubName", "==", queryParams.get("name"))); | ||
const qsnap = await getDocs(q); | ||
|
||
|
||
const docData = qsnap.docs[0].data(); | ||
console.log(docData) | ||
console.log(docData["BookClubName"]); | ||
return docData; | ||
} | ||
|
||
async function getEmailFromUID(uid) | ||
{ | ||
const q = query(collection(db, "Users"), where("uid", "==", uid)); | ||
const qsnap = await getDocs(q); | ||
|
||
return qsnap.docs[0].data()["email"]; | ||
} | ||
|
||
let docData = await getClubDocFromQParams(queryParams); | ||
|
||
document.getElementById("clubName").textContent = docData["BookClubName"] | ||
document.getElementById("clubDescription").textContent = docData["clubDescription"] | ||
|
||
for (const uid of docData["ClubUsers"]) | ||
{ | ||
const newLI = document.createElement("li"); | ||
newLI.textContent = await getEmailFromUID(uid); | ||
|
||
const parentUL = document.getElementById("members"); | ||
parentUL.appendChild(newLI); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters