Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(classData.js): Fix the usage of getDocs function #10

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/utils/firestore/classData.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Functions for fetching and storing class data in Firestore
import { db } from '@utils/firebaseConfig';
import { collection, doc, getDoc, setDoc, updateDoc } from 'firebase/firestore';
import { collection, doc, getDoc, getDocs, setDoc, updateDoc } from 'firebase/firestore';

// Get latest term from APi and update if necessary
const checkAndInsertLatestTerm = async () => {
Expand Down Expand Up @@ -67,7 +67,7 @@ export const fetchAndStoreClassData = async () => {

// Clear the existing courseData collection in Firestore
const courseDataRef = collection(db, 'courseData');
const courseDataSnapshot = await courseDataRef.get();
const courseDataSnapshot = await getDocs(courseDataRef);
courseDataSnapshot.forEach(async (doc) => {
await setDoc(doc.ref, { numbers: [] });
});
Expand Down
Loading