@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react';
22import { makeStyles } from '@material-ui/core/styles' ;
33import GridItem from '../../../components/Grid/GridItem' ;
44import GridContainer from '../../../components/Grid/GridContainer' ;
5+ import { useNavigate } from 'react-router-dom' ;
56import Button from '@material-ui/core/Button' ;
67import Table from '@material-ui/core/Table' ;
78import TableBody from '@material-ui/core/TableBody' ;
@@ -25,10 +26,13 @@ export default function UserList(props) {
2526 const [ , setAuth ] = useState ( true ) ;
2627 const [ isLoading , setIsLoading ] = useState ( false ) ;
2728 const [ isError , setIsError ] = useState ( false ) ;
29+ const navigate = useNavigate ( ) ;
2830 const [ currentPage , setCurrentPage ] = useState ( 1 ) ;
2931 const itemsPerPage = 5 ;
3032 const [ searchQuery , setSearchQuery ] = useState ( '' ) ;
3133
34+ const openUser = ( username ) => navigate ( `/admin/user/${ username } ` , { replace : true } ) ;
35+
3236
3337 useEffect ( ( ) => {
3438 const query = { } ;
@@ -98,7 +102,11 @@ export default function UserList(props) {
98102 { row . admin ? < Check fontSize = 'small' color = 'primary' /> : < CloseRounded color = 'error' /> }
99103 </ TableCell >
100104 < TableCell component = 'th' scope = 'row' >
101- < Button variant = 'contained' color = 'primary' >
105+ < Button
106+ variant = 'contained'
107+ color = 'primary'
108+ onClick = { ( ) => openUser ( row . username ) }
109+ >
102110 < KeyboardArrowRight />
103111 </ Button >
104112 </ TableCell >
0 commit comments