From 6f55c8a4e6c61e61cefc42012dcbe781e9459d39 Mon Sep 17 00:00:00 2001 From: Sonu Kumar <1AT20IS092@visioneer.atria.edu> Date: Fri, 15 Mar 2024 21:00:36 +0530 Subject: [PATCH] Done --- frontend/src/components/Profile/Profile.js | 56 ++++++++++++++----- .../src/components/Profile/Profile.module.css | 13 +---- .../assets/InputControl/OutputControl.js | 2 +- .../InputControl/OutputControl.module.css | 10 +--- frontend/src/components/assets/Navbar.jsx | 4 +- frontend/src/components/assets/constants.js | 4 +- 6 files changed, 51 insertions(+), 38 deletions(-) diff --git a/frontend/src/components/Profile/Profile.js b/frontend/src/components/Profile/Profile.js index d9372216..9f340bb7 100644 --- a/frontend/src/components/Profile/Profile.js +++ b/frontend/src/components/Profile/Profile.js @@ -1,15 +1,45 @@ -import React from 'react' +import React, {useEffect} from 'react' import styles from './Profile.module.css' import OutputControl from '../assets/InputControl/OutputControl' -import { Firestore } from 'firebase/firestore' -import { db } from '../../firebase' +import { auth, db } from '../../firebase' +import { Navbar } from '../assets' function Profile() { + useEffect(() => { + auth.onAuthStateChanged((user) => { + if (user) { + console.log('User is signed in', user.uid); + const userName = user.displayName; + + // Get the Firestore document reference for the user + // const userRef = db.collection('Users').doc(); + + // // Retrieve the user data from Firestore + // userRef.get().then((doc) => { + // if (doc.exists) { + // const userData = doc.data(); + // console.log('User data:', userData); + // // Do something with the user data + // } else { + // console.log('User data not found'); + // } + // }).catch((error) => { + // console.log('Error getting user data:', error); + // }); + } else { + console.log('User is signed out'); + } + }); + }, []); + return ( -