Skip to content

Commit 5362740

Browse files
committed
People have names
1 parent 210b443 commit 5362740

3 files changed

Lines changed: 4 additions & 5 deletions

File tree

my-app/firebase.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function connectToFirebase(model) {
2727
loadCoursesFromCacheOrFirebase(model);
2828
onAuthStateChanged(auth, (user) => {
2929
if (user) {
30-
model.setUser(user.uid); // Set the user ID once authenticated
30+
model.setUser(user); // Set the user ID once authenticated
3131
firebaseToModel(model); // Set up listeners for user-specific data
3232
syncModelToFirebase(model); // Start syncing changes to Firebase
3333
} else {
@@ -40,7 +40,7 @@ export function connectToFirebase(model) {
4040
async function firebaseToModel(model) {
4141
if (!model.user)
4242
return;
43-
const userRef = ref(db, `users/${model.user}`);
43+
const userRef = ref(db, `users/${model.user.uid}`);
4444
onValue(userRef, (snapshot) => {
4545
if (!snapshot.exists())
4646
return;
@@ -58,7 +58,7 @@ async function firebaseToModel(model) {
5858
export function syncModelToFirebase(model) {
5959
reaction(
6060
() => ({
61-
userId: model?.user,
61+
userId: model?.user.uid,
6262
favourites: toJS(model.favourites),
6363
// currentSearch: toJS(model.currentSearch),
6464
// Add more per-user attributes here

my-app/src/presenters/ReviewPresenter.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const ReviewPresenter = observer(({ model, course }) => {
2020
const handleReviewSubmit = async () => {
2121
if (newReview.trim()) {
2222
const review = {
23-
userName: model.user?.name || "Anonymous",
23+
userName: model.user?.displayName || "Anonymous",
2424
text: newReview,
2525
timestamp: Date.now(), //timestamp
2626
};

my-app/src/views/ReviewView.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export function ReviewView({
1111

1212
return (
1313
<div>
14-
<h3 className="text-2xl font-semibold text-[#2e2e4f]">Reviews</h3>
1514
{/* Reviews Section */}
1615
<div className="mt-4">
1716
<input

0 commit comments

Comments
 (0)