Make the login and register components clear errors as soon as they are mounted
This commit is contained in:
parent
5a34b415f2
commit
f3c429692c
|
|
@ -3,7 +3,10 @@ import React from 'react';
|
|||
import {connect} from 'react-redux';
|
||||
import Router from 'next/router';
|
||||
|
||||
import {login} from '../api';
|
||||
import {
|
||||
login,
|
||||
clearErrors
|
||||
} from '../api';
|
||||
|
||||
export function Login(props) {
|
||||
return (
|
||||
|
|
@ -84,6 +87,10 @@ class LoginForm extends React.Component {
|
|||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
clearErrors();
|
||||
}
|
||||
|
||||
tryLogin(event) {
|
||||
event.preventDefault();
|
||||
login(this.state.email, this.state.password);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,10 @@ import {
|
|||
import { TurniereNavigation } from '../js/components/Navigation';
|
||||
import { Footer } from '../js/components/Footer';
|
||||
import { register } from '../js/api';
|
||||
import { verifyCredentials } from '../js/api';
|
||||
import {
|
||||
verifyCredentials,
|
||||
clearErrors
|
||||
} from '../js/api';
|
||||
|
||||
import '../static/everypage.css';
|
||||
|
||||
|
|
@ -43,20 +46,27 @@ export default class RegisterPage extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
function Register() {
|
||||
return (
|
||||
<Container className="py-5">
|
||||
<Card className="shadow">
|
||||
<CardBody>
|
||||
<h1 className="custom-font">Account anlegen</h1>
|
||||
<RegisterForm/>
|
||||
<div className="mt-3">
|
||||
<a href="/login" className="mr-3">Ich habe bereits einen Account!</a>
|
||||
</div>
|
||||
</CardBody>
|
||||
</Card>
|
||||
</Container>
|
||||
);
|
||||
class Register extends React.Component {
|
||||
|
||||
componentDidMount() {
|
||||
clearErrors();
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Container className="py-5">
|
||||
<Card className="shadow">
|
||||
<CardBody>
|
||||
<h1 className="custom-font">Account anlegen</h1>
|
||||
<RegisterForm/>
|
||||
<div className="mt-3">
|
||||
<a href="/login" className="mr-3">Ich habe bereits einen Account!</a>
|
||||
</div>
|
||||
</CardBody>
|
||||
</Card>
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class RegisterErrorList extends React.Component {
|
||||
|
|
|
|||
Loading…
Reference in New Issue