October 2017
Intermediate to advanced
302 pages
7h 27m
English
Since we expect an error to be returned (since we haven't signed up with any email and password combination), we can leave our then statement blank, but add a console log to our catch statement:
handleSubmit = (event) => { event.preventDefault(); this.setState({ error: '' }); if (this.state.email && this.state.password) { firebase.auth().signInWithEmailAndPassword(this.state.email, this.state.password) .then(res => { console.log(res); }) .catch(err => { console.log(err); }) } else { this.setState({ error: 'Please fill in both fields.' }); }}
Submit your form, and you should be returned the following error:
{code: "auth/user-not-found", message: "There is no user record corresponding to this identifier. The user may ...Read now
Unlock full access