1const {email, password} = this.state;
2 this.setState({ error: '', loading: true });
3 firebase.auth().signInWithEmailAndPassword(email.trim(), password)
4 .then(this.onLoginSuccess.bind(this))
5 .catch( (err) => {
6 firebase.auth().createUserWithEmailAndPassword(email.trim(), password)
7 .then(this.onLoginSuccess.bind(this))
8 .catch(this.onLoginFailed.bind(this));
9 });
10