📅  最后修改于: 2022-03-11 15:02:41.600000             🧑  作者: Mango
const {email, password} = this.state;
this.setState({ error: '', loading: true });
firebase.auth().signInWithEmailAndPassword(email.trim(), password)
.then(this.onLoginSuccess.bind(this))
.catch( (err) => {
firebase.auth().createUserWithEmailAndPassword(email.trim(), password)
.then(this.onLoginSuccess.bind(this))
.catch(this.onLoginFailed.bind(this));
});