@@ -17,6 +17,7 @@ import { addUser } from '../../../services/repo';
1717import { getUsers } from '../../../services/user' ;
1818import { PersonAdd } from '@material-ui/icons' ;
1919import { UserData } from '../../../../types/models' ;
20+ import Danger from '../../../components/Typography/Danger' ;
2021
2122interface AddUserDialogProps {
2223 repoName : string ;
@@ -37,7 +38,7 @@ const AddUserDialog: React.FC<AddUserDialogProps> = ({
3738 const [ data , setData ] = useState < UserData [ ] > ( [ ] ) ;
3839 const [ , setAuth ] = useState < boolean > ( true ) ;
3940 const [ isLoading , setIsLoading ] = useState < boolean > ( false ) ;
40- const [ isError , setIsError ] = useState < boolean > ( false ) ;
41+ const [ errorMessage , setErrorMessage ] = useState < string > ( '' ) ;
4142 const [ error , setError ] = useState < string > ( '' ) ;
4243 const [ tip , setTip ] = useState < boolean > ( false ) ;
4344
@@ -76,10 +77,10 @@ const AddUserDialog: React.FC<AddUserDialogProps> = ({
7677 } ;
7778
7879 useEffect ( ( ) => {
79- getUsers ( setIsLoading , setData , setAuth , setIsError , setError , { } ) ;
80+ getUsers ( setIsLoading , setData , setAuth , setErrorMessage , { } ) ;
8081 } , [ ] ) ;
8182
82- if ( isError ) return < div > Something went wrong ... </ div > ;
83+ if ( errorMessage ) return < Danger > { errorMessage } </ Danger > ;
8384
8485 return (
8586 < >
0 commit comments