Skip to content

Commit

Permalink
fix: the usage of getDocs function (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
WeiViv authored Oct 17, 2024
1 parent 1b8099e commit 2776139
Showing 1 changed file with 2 additions and 2 deletions.
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

0 comments on commit 2776139

Please sign in to comment.