mirror of
https://github.com/ansible/awx.git
synced 2026-02-01 17:48:10 -03:30
lint
This commit is contained in:
@@ -7,67 +7,59 @@ import api from '../api';
|
||||
|
||||
class Login extends Component {
|
||||
state = {
|
||||
username: '',
|
||||
password: '',
|
||||
redirect: false,
|
||||
username: '',
|
||||
password: '',
|
||||
redirect: false,
|
||||
};
|
||||
|
||||
handleChange = event => this.setState({ [event.target.name]: event.target.value });
|
||||
|
||||
handleSubmit = event => {
|
||||
const { username, password } = this.state;
|
||||
const { username, password } = this.state;
|
||||
|
||||
event.preventDefault();
|
||||
event.preventDefault();
|
||||
|
||||
api.login(username, password)
|
||||
.then(() => this.setState({ redirect: true }))
|
||||
.then(() => api.getProjects())
|
||||
.then(res => console.log(res));
|
||||
};
|
||||
.then(() => this.setState({ redirect: true }));
|
||||
}
|
||||
|
||||
render() {
|
||||
render () {
|
||||
const { username, password, redirect } = this.state;
|
||||
|
||||
if (redirect) {
|
||||
return (<Redirect to={'/'} />);
|
||||
}
|
||||
|
||||
if (redirect) {
|
||||
return (<Redirect to="/" />);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='column'>
|
||||
<form onSubmit={this.handleSubmit}>
|
||||
<div className='field'>
|
||||
<label className='label'>Username</label>
|
||||
<div className='control'>
|
||||
<input
|
||||
className='input'
|
||||
type='text'
|
||||
name='username'
|
||||
onChange={this.handleChange}
|
||||
value={username}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className='field'>
|
||||
<label className='label'>Password</label>
|
||||
<div className='control'>
|
||||
<input
|
||||
className='input'
|
||||
type='password'
|
||||
name='password'
|
||||
onChange={this.handleChange}
|
||||
value={password}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className='control'>
|
||||
<Button type='submit'>
|
||||
Login
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<form onSubmit={this.handleSubmit}>
|
||||
<div className="field">
|
||||
<label htmlFor="username">
|
||||
Username
|
||||
<input
|
||||
id="username"
|
||||
name="username"
|
||||
type="text"
|
||||
onChange={this.handleChange}
|
||||
value={username}
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<label htmlFor="password">
|
||||
Password
|
||||
<input
|
||||
id="password"
|
||||
name="password"
|
||||
type="password"
|
||||
onChange={this.handleChange}
|
||||
value={password}
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<Button type="submit">
|
||||
Login
|
||||
</Button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user