forked from p34709852/monkey
Alter registration page to show loading icon while registration request is being processed
This commit is contained in:
parent
c211d51d8c
commit
579ebf4a0f
|
@ -4,11 +4,13 @@ import {Row, Col, Container, Form, Button} from 'react-bootstrap';
|
||||||
import AuthService from '../../services/AuthService';
|
import AuthService from '../../services/AuthService';
|
||||||
import monkeyDetective from '../../images/detective-monkey.svg';
|
import monkeyDetective from '../../images/detective-monkey.svg';
|
||||||
import ParticleBackground from '../ui-components/ParticleBackground';
|
import ParticleBackground from '../ui-components/ParticleBackground';
|
||||||
|
import LoadingIcon from '../ui-components/LoadingIcon';
|
||||||
|
|
||||||
class RegisterPageComponent extends React.Component {
|
class RegisterPageComponent extends React.Component {
|
||||||
|
|
||||||
register = (event) => {
|
register = (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
this.setState({loading: true})
|
||||||
this.auth.register(this.username, this.password).then(res => {
|
this.auth.register(this.username, this.password).then(res => {
|
||||||
this.setState({failed: false, error: ''});
|
this.setState({failed: false, error: ''});
|
||||||
if (res['result']) {
|
if (res['result']) {
|
||||||
|
@ -68,7 +70,12 @@ class RegisterPageComponent extends React.Component {
|
||||||
<Form.Control onChange={evt => this.updateUsername(evt)} type='text' placeholder='Username'/>
|
<Form.Control onChange={evt => this.updateUsername(evt)} type='text' placeholder='Username'/>
|
||||||
<Form.Control onChange={evt => this.updatePassword(evt)} type='password' placeholder='Password'/>
|
<Form.Control onChange={evt => this.updatePassword(evt)} type='password' placeholder='Password'/>
|
||||||
<Button className={'monkey-submit-button'} type={'submit'} >
|
<Button className={'monkey-submit-button'} type={'submit'} >
|
||||||
Let's go!
|
{
|
||||||
|
this.state.loading ?
|
||||||
|
<LoadingIcon/>
|
||||||
|
:
|
||||||
|
'Let\'s go!'
|
||||||
|
}
|
||||||
</Button>
|
</Button>
|
||||||
<Row>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
|
|
|
@ -35,3 +35,11 @@
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.auth-container .monkey-submit-button:hover .loading-icon {
|
||||||
|
color: $monkey-black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.auth-container .monkey-submit-button:focus .loading-icon {
|
||||||
|
color: $monkey-black;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue