-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: timePreferences saved but not updating in frontend. (#15)
- Loading branch information
Showing
2 changed files
with
22 additions
and
23 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// User profile operations (get, update, check) | ||
import { db } from '@utils/firebaseConfig'; | ||
import { doc, setDoc, getDoc, updateDoc, onSnapshot } from 'firebase/firestore'; | ||
import { doc, setDoc, getDoc, updateDoc } from 'firebase/firestore'; | ||
|
||
// Unified function to fetch and listen to user profile changes by UID | ||
// (supports both regular and transaction-based fetches) | ||
|
@@ -81,16 +81,3 @@ export const updateUserProfile = async (uid, updates) => { | |
// email: "[email protected]", | ||
// major: "Computer Science" | ||
// }); | ||
|
||
// Function to save/update time preferences in Firebase | ||
export const saveTimePreferences = async (uid, selectedTimes) => { | ||
try { | ||
const userDocRef = doc(db, 'users', uid); | ||
await updateDoc(userDocRef, { | ||
timePreferences: selectedTimes, // Update timePreferences field | ||
}); | ||
console.warn('Time preferences updated successfully.'); | ||
} catch (error) { | ||
console.error('Error updating time preferences:', error); | ||
} | ||
}; |