diff options
Diffstat (limited to 'src/components/Header/Header.tsx')
-rw-r--r-- | src/components/Header/Header.tsx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx index d0d9081..49f427f 100644 --- a/src/components/Header/Header.tsx +++ b/src/components/Header/Header.tsx @@ -9,11 +9,11 @@ import { makeStyles } from '@material-ui/core/styles'; import AccountCircle from '@material-ui/icons/AccountCircle'; import NotificationsIcon from '@material-ui/icons/Notifications'; import HomeIcon from '@material-ui/icons/Home'; +import { useAuth } from '../../hooks/useAuth'; import SearchBar from './SearchBar'; interface PropTypes { - userImage: string | undefined; navigate: (prefix: string) => void; } @@ -33,8 +33,9 @@ const useStyles = makeStyles({ } }); -const Header: React.FC<PropTypes> = ({ navigate, userImage }) => { +const Header: React.FC<PropTypes> = ({ navigate }) => { const classes = useStyles(); + const { user } = useAuth(); const handleHome = (): void => { navigate('feed'); @@ -62,8 +63,8 @@ const Header: React.FC<PropTypes> = ({ navigate, userImage }) => { </IconButton> <IconButton onClick={handleProfile}> { - userImage?.match(/\.(jpeg|jpg|gif|png)$/) - ? <Avatar className={classes.avatar} src={userImage} /> + user?.avatarUrl?.match(/\.(jpeg|jpg|gif|png)$/) + ? <Avatar className={classes.avatar} src={user?.avatarUrl} /> : <AccountCircle /> } </IconButton> |