From 4998f3a2d53964ad23465fd0950c4278affaa2a8 Mon Sep 17 00:00:00 2001 From: Steve White Date: Thu, 17 Oct 2024 10:43:58 -0500 Subject: [PATCH 1/2] Fixing MaterialUI stuff --- src/components/Admin.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/components/Admin.js b/src/components/Admin.js index 3a2e68e..ed13972 100644 --- a/src/components/Admin.js +++ b/src/components/Admin.js @@ -17,13 +17,15 @@ import { Alert, Container, Box, - TextField + TextField, + Tab } from '@mui/material'; export default function Admin() { const [users, setUsers] = useState([]); const [username, setUsername] = useState(''); + const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const navigate = useNavigate(); const fileInputRef = useRef(null); @@ -59,13 +61,15 @@ export default function Admin() { try { const response = await axios.post(`${process.env.REACT_APP_API_URL}/admin/user`, { username, - password + password, + email }, { headers: { Authorization: `Bearer ${localStorage.getItem('token')}` } }); setUsers([...users, response.data]); setUsername(''); setPassword(''); + setEmail(''); } catch (error) { console.error(error); } @@ -158,6 +162,13 @@ export default function Admin() { onChange={(e) => setPassword(e.target.value)} sx={{ mr: 2 }} /> + setEmail(e.target.value)} + sx={{ mr: 2 }} + /> @@ -167,14 +178,18 @@ export default function Admin() { + ID Username + Email Actions {users.map(user => ( - {user.username} + {user.ID} + {user.username} + {user.email}