@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react';
2
2
import { makeStyles } from '@material-ui/core/styles' ;
3
3
import GridItem from '../../../components/Grid/GridItem' ;
4
4
import GridContainer from '../../../components/Grid/GridContainer' ;
5
+ import { useNavigate } from 'react-router-dom' ;
5
6
import Button from '@material-ui/core/Button' ;
6
7
import Table from '@material-ui/core/Table' ;
7
8
import TableBody from '@material-ui/core/TableBody' ;
@@ -25,10 +26,13 @@ export default function UserList(props) {
25
26
const [ , setAuth ] = useState ( true ) ;
26
27
const [ isLoading , setIsLoading ] = useState ( false ) ;
27
28
const [ isError , setIsError ] = useState ( false ) ;
29
+ const navigate = useNavigate ( ) ;
28
30
const [ currentPage , setCurrentPage ] = useState ( 1 ) ;
29
31
const itemsPerPage = 5 ;
30
32
const [ searchQuery , setSearchQuery ] = useState ( '' ) ;
31
33
34
+ const openUser = ( username ) => navigate ( `/admin/user/${ username } ` , { replace : true } ) ;
35
+
32
36
33
37
useEffect ( ( ) => {
34
38
const query = { } ;
@@ -98,7 +102,11 @@ export default function UserList(props) {
98
102
{ row . admin ? < Check fontSize = 'small' color = 'primary' /> : < CloseRounded color = 'error' /> }
99
103
</ TableCell >
100
104
< 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
+ >
102
110
< KeyboardArrowRight />
103
111
</ Button >
104
112
</ TableCell >
0 commit comments