Added logout button functionality

This commit is contained in:
2020-11-04 12:34:37 +01:00
parent 8e6759f917
commit 05a8d7f090
7 changed files with 75 additions and 33 deletions

View File

@ -5,6 +5,7 @@ import { makeStyles, createStyles, Theme } from '@material-ui/core/styles';
import AuthService from './AuthService';
export default function Auth(props: any) {
props.onAuthenticated();
const history = useHistory();
const classes = useStyles();
@ -36,7 +37,6 @@ export default function Auth(props: any) {
};
const onLoginClicked = () => {
setIsLoggingIn(true);
if (!username) {
setShowError(true);
@ -52,6 +52,7 @@ export default function Auth(props: any) {
return;
}
setIsLoggingIn(true);
AuthService.login(username, password)
.then(() => {
props.onAuthenticated();
@ -86,7 +87,7 @@ export default function Auth(props: any) {
</Typography>
</Grid>
<Grid item xs={12} >
<TextField label="Username" type="text" onChange={onUsernameChanged} />
<TextField autoFocus label="Username" type="text" onChange={onUsernameChanged} />
</Grid>
<Grid item xs={12} >
<TextField label="Password" type="password" onChange={onPasswordChanged} onKeyPress={onPasswordKeyPress} />