diff options
Diffstat (limited to 'webui/src/layout/CurrentIdentity.tsx')
-rw-r--r-- | webui/src/layout/CurrentIdentity.tsx | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/webui/src/layout/CurrentIdentity.tsx b/webui/src/layout/CurrentIdentity.tsx index 55060179..21f489ef 100644 --- a/webui/src/layout/CurrentIdentity.tsx +++ b/webui/src/layout/CurrentIdentity.tsx @@ -3,7 +3,7 @@ import React from 'react'; import Avatar from '@material-ui/core/Avatar'; import { makeStyles } from '@material-ui/core/styles'; -import CurrentIdentityContext from './CurrentIdentityContext'; +import { useCurrentIdentityQuery } from './CurrentIdentity.generated'; const useStyles = makeStyles(theme => ({ displayName: { @@ -13,26 +13,18 @@ const useStyles = makeStyles(theme => ({ const CurrentIdentity = () => { const classes = useStyles(); + const { loading, error, data } = useCurrentIdentityQuery(); - return ( - <CurrentIdentityContext.Consumer> - {context => { - if (!context) return null; - const { loading, error, data } = context as any; - - if (error || loading || !data?.repository?.userIdentity) return null; + if (error || loading || !data?.repository?.userIdentity) return null; - const user = data.repository.userIdentity; - return ( - <> - <Avatar src={user.avatarUrl ? user.avatarUrl : undefined}> - {user.displayName.charAt(0).toUpperCase()} - </Avatar> - <div className={classes.displayName}>{user.displayName}</div> - </> - ); - }} - </CurrentIdentityContext.Consumer> + const user = data.repository.userIdentity; + return ( + <> + <Avatar src={user.avatarUrl ? user.avatarUrl : undefined}> + {user.displayName.charAt(0).toUpperCase()} + </Avatar> + <div className={classes.displayName}>{user.displayName}</div> + </> ); }; |