Skip to content

Commit

Permalink
Update Header.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
Zain-ul-din authored Oct 25, 2024
1 parent 1f0a05d commit d015c51
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
addLoggedInUser,
reportFirebaseAnalytics
} from '~/lib/FirebaseAnalysis';
import { useContext } from 'react';
import { useContext, useEffect } from 'react';
import { UserCredentialsContext } from '~/hooks/UserCredentialsContext';
import { Tooltip } from '@chakra-ui/react';
import { useRouter } from 'next/router';
Expand All @@ -25,6 +25,11 @@ const secular_One = Secular_One({ subsets: ['latin'], weight: '400' });
export default function Header() {
const user = useContext(UserCredentialsContext);

useEffect(() => {
if(!user.user) return;
addLoggedInUser(user.user as User);
}, [user])

return (
<div
className={styles.header_wrapper + ' ' + 'glow glow_sm' + ' roboto'}
Expand All @@ -51,9 +56,10 @@ export const NotLoggedIn = ({ text, isLoading }: { text: string; isLoading?: boo
<Btn
colorScheme="linkedin"
onClick={(e) => {
signInWithPopup(firebase.firebaseAuth, new GoogleAuthProvider()).then(
(data: UserCredential) => addLoggedInUser(data.user)
);
signInWithPopup(firebase.firebaseAuth, new GoogleAuthProvider());
// .then(
// (data: UserCredential) =>
// );
}}
fontWeight={'bold'}
isLoading={isLoading}>
Expand Down

0 comments on commit d015c51

Please sign in to comment.