minor changes
This commit is contained in:
parent
528cb80c1f
commit
532b5d3876
@ -4,6 +4,7 @@ import SignIn from './SignIn';
|
||||
import SignUp from './SignUp';
|
||||
import Admin from './Admin';
|
||||
import Home from './Home';
|
||||
import ChatWindow from './ChatWindow';
|
||||
function App() {
|
||||
return (
|
||||
<div className="App">
|
||||
@ -12,6 +13,7 @@ function App() {
|
||||
<Route path="sign-in" element={<SignIn />} />
|
||||
<Route path="sign-up" element={<SignUp />} />
|
||||
<Route path="admin" element={<Admin />} />
|
||||
<Route path="chat-window" element={<ChatWindow />} />
|
||||
</Routes>
|
||||
</div>
|
||||
);
|
||||
|
@ -108,7 +108,7 @@ export default function Navbar() {
|
||||
|
||||
<Box sx={{ flexGrow: 0, marginRight: '1%' }}>
|
||||
<Tooltip title="Chats">
|
||||
<IconButton sx={{ p: 0 }}>
|
||||
<IconButton onClick={() => { navigate('/chat-window') }} sx={{ p: 0 }}>
|
||||
<ForumIcon sx={{ color: 'white' }}></ForumIcon>
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
|
@ -16,60 +16,63 @@ export default function SignIn() {
|
||||
event.preventDefault();
|
||||
const data = new FormData(event.currentTarget);
|
||||
// eslint-disable-next-line no-console
|
||||
if(data.get('username') == "admin" && data.get('password') == "admin"){
|
||||
navigate('/');
|
||||
if (data.get('username') === "admin" && data.get('password') === "admin") {
|
||||
navigate('/admin');
|
||||
} else if (data.get('username') === "user" && data.get('password') === "user") {
|
||||
navigate('/chat-window')
|
||||
}
|
||||
};
|
||||
return (
|
||||
<Container component="main" maxWidth="xs">
|
||||
<CssBaseline />
|
||||
<Box
|
||||
sx={{
|
||||
marginTop: 8,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
}}
|
||||
>
|
||||
<Avatar sx={{ m: 1, bgcolor: 'primary.main' }}>
|
||||
<AccountCircleIcon />
|
||||
</Avatar>
|
||||
<Typography component="h1" variant="h5">
|
||||
Sign in
|
||||
</Typography>
|
||||
<Box component="form" noValidate sx={{ mt: 1 }} onSubmit={handleSubmit}>
|
||||
<TextField
|
||||
margin="normal"
|
||||
required
|
||||
fullWidth
|
||||
id="username"
|
||||
label="Username"
|
||||
name="username"
|
||||
autoComplete="username"
|
||||
autoFocus
|
||||
/>
|
||||
<TextField
|
||||
margin="normal"
|
||||
required
|
||||
fullWidth
|
||||
name="password"
|
||||
label="Password"
|
||||
type="password"
|
||||
id="password"
|
||||
autoComplete="current-password"
|
||||
/>
|
||||
<Button
|
||||
type="submit"
|
||||
fullWidth
|
||||
variant="contained"
|
||||
sx={{ mt: 3, mb: 2 }}
|
||||
>
|
||||
Sign In
|
||||
</Button>
|
||||
<Link href="/sign-up" underline="always">
|
||||
<Container component="main" maxWidth="xs">
|
||||
<CssBaseline />
|
||||
<Box
|
||||
sx={{
|
||||
marginTop: 8,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
}}
|
||||
>
|
||||
<Avatar sx={{ m: 1, bgcolor: 'primary.main' }}>
|
||||
<AccountCircleIcon />
|
||||
</Avatar>
|
||||
<Typography component="h1" variant="h5">
|
||||
Sign in
|
||||
</Typography>
|
||||
<Box component="form" noValidate sx={{ mt: 1 }} onSubmit={handleSubmit}>
|
||||
<TextField
|
||||
margin="normal"
|
||||
required
|
||||
fullWidth
|
||||
id="username"
|
||||
label="Username"
|
||||
name="username"
|
||||
autoComplete="username"
|
||||
autoFocus
|
||||
/>
|
||||
<TextField
|
||||
margin="normal"
|
||||
required
|
||||
fullWidth
|
||||
name="password"
|
||||
label="Password"
|
||||
type="password"
|
||||
id="password"
|
||||
autoComplete="current-password"
|
||||
/>
|
||||
<Button
|
||||
type="submit"
|
||||
fullWidth
|
||||
variant="contained"
|
||||
sx={{ mt: 3, mb: 2 }}
|
||||
>
|
||||
Sign In
|
||||
</Button>
|
||||
<Link href="/sign-up" underline="always">
|
||||
{"Don't have an account?"}
|
||||
</Link>
|
||||
</Box>
|
||||
</Box>
|
||||
</Container>
|
||||
)}
|
||||
</Link>
|
||||
</Box>
|
||||
</Box>
|
||||
</Container>
|
||||
)
|
||||
}
|
Loading…
Reference in New Issue
Block a user