aboutsummaryrefslogtreecommitdiff
path: root/src/pages/ProfilePage/ProfileInfo.tsx
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-08-09 19:51:32 +0300
committereug-vs <eug-vs@keemail.me>2020-08-09 19:51:32 +0300
commitb6f9dbc3cbb21447fdeb22420b005da37de2af8e (patch)
tree158ecaac5a7bdabd4519fb8347bd92dce80dfea5 /src/pages/ProfilePage/ProfileInfo.tsx
parent74d34ff5072d2582cf825121e901eed3401e63b9 (diff)
downloadwhich-ui-b6f9dbc3cbb21447fdeb22420b005da37de2af8e.tar.gz
feat: use SWR in profile page
Diffstat (limited to 'src/pages/ProfilePage/ProfileInfo.tsx')
-rw-r--r--src/pages/ProfilePage/ProfileInfo.tsx9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/pages/ProfilePage/ProfileInfo.tsx b/src/pages/ProfilePage/ProfileInfo.tsx
index e4ef66a..8b1447a 100644
--- a/src/pages/ProfilePage/ProfileInfo.tsx
+++ b/src/pages/ProfilePage/ProfileInfo.tsx
@@ -16,7 +16,6 @@ interface PropTypes {
totalVotes: number;
userInfo: User | undefined;
setUserInfo: (userInfo: User) => void;
- isLoading: boolean;
}
const useStyles = makeStyles(theme => ({
@@ -83,7 +82,7 @@ const useStyles = makeStyles(theme => ({
const ProfileInfo: React.FC<PropTypes> = ({
- savedPolls, totalVotes, setUserInfo, userInfo, isLoading
+ savedPolls, totalVotes, setUserInfo, userInfo
}) => {
const classes = useStyles();
const [input, setInput] = useState(false);
@@ -105,7 +104,7 @@ const ProfileInfo: React.FC<PropTypes> = ({
return (
<div className={classes.root}>
{
- isLoading
+ !userInfo
? <Skeleton animation="wave" variant="circle" width={150} height={150} className={classes.avatar} />
: userInfo?._id === localStorage.getItem('userId')
? (
@@ -133,7 +132,7 @@ const ProfileInfo: React.FC<PropTypes> = ({
: <Avatar className={classes.avatar} src={userInfo?.avatarUrl} />
}
{
- isLoading
+ !userInfo
? <Skeleton animation="wave" variant="rect" width={100} height={20} className={classes.skeleton} />
: (
<Typography variant="h5" className={classes.name}>
@@ -144,7 +143,7 @@ const ProfileInfo: React.FC<PropTypes> = ({
}
<div className={classes.profileMenu}>
{
- isLoading
+ !userInfo
? (
<>
<Skeleton animation="wave" variant="rect" width={170} height={20} className={classes.skeleton} />