File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -13,11 +13,15 @@ import {useState} from "react";
1313import { CredentialsShowModal , CredentialsTable } from "../../lib/components/auth/credentials" ;
1414import { useRouter } from "../../lib/hooks/router" ;
1515
16+ const resolveDisplayName = ( user ) => {
17+ if ( ! user ) return "" ;
18+ if ( user ?. email ?. length ) return user . email ;
19+ return user . id ;
20+ }
1621
1722const CredentialsContainer = ( ) => {
1823 const router = useRouter ( ) ;
1924 const { user } = useUser ( ) ;
20- const userId = ( user ) ? user . id : "" ;
2125 const [ refreshToken , setRefreshToken ] = useState ( false ) ;
2226 const [ createError , setCreateError ] = useState ( null ) ;
2327 const [ createdKey , setCreatedKey ] = useState ( null ) ;
@@ -41,7 +45,7 @@ const CredentialsContainer = () => {
4145 < ConfirmationButton
4246 variant = "success"
4347 modalVariant = "success"
44- msg = { < span > Create a new Access Key for user < strong > { userId } </ strong > ?</ span > }
48+ msg = { < span > Create a new Access Key for user < strong > { resolveDisplayName ( user ) } </ strong > ?</ span > }
4549 onConfirm = { hide => {
4650 createKey ( )
4751 . then ( key => { setCreatedKey ( key ) } )
You can’t perform that action at this time.
0 commit comments