diff options
author | ludovicm67 <ludovicmuller1@gmail.com> | 2020-01-24 00:43:12 +0100 |
---|---|---|
committer | ludovicm67 <ludovicmuller1@gmail.com> | 2020-01-24 00:43:12 +0100 |
commit | 70354165ff1956dd0598ff69736fb0436612003c (patch) | |
tree | 6f0c98fcfefc9b2d012cd10bff922ea47fb19652 /webui | |
parent | 7de5a25ffa0b2c45db9cb2da0e142b5b5b6d5b7d (diff) | |
download | git-bug-70354165ff1956dd0598ff69736fb0436612003c.tar.gz |
webui: remove useless conditions
Diffstat (limited to 'webui')
-rw-r--r-- | webui/src/CurrentIdentity.js | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/webui/src/CurrentIdentity.js b/webui/src/CurrentIdentity.js index c8afc531..451979fb 100644 --- a/webui/src/CurrentIdentity.js +++ b/webui/src/CurrentIdentity.js @@ -25,22 +25,16 @@ const CurrentIdentity = () => { const classes = useStyles(); return ( <Query query={QUERY}> - {({ error, data }) => { - if ( - error || - !data || - !data.defaultRepository || - !data.defaultRepository.userIdentity || - !data.defaultRepository.userIdentity.displayName - ) - return <></>; - const displayName = - data.defaultRepository.userIdentity.displayName || ''; - const avatar = data.defaultRepository.userIdentity.avatarUrl; + {({ loading, error, data }) => { + if (error || loading || !data.defaultRepository.userIdentity) + return null; + const user = data.defaultRepository.userIdentity; return ( <> - <Avatar src={avatar}>{displayName.charAt(0).toUpperCase()}</Avatar> - <div className={classes.displayName}>{displayName}</div> + <Avatar src={user.avatarUrl}> + {user.displayName.charAt(0).toUpperCase()} + </Avatar> + <div className={classes.displayName}>{user.displayName}</div> </> ); }} |