我正在通过Firebase电话号码实施登录方法,应该在其中接收otp。我已经正确实施了。
export const phoneauth = () => {
return async (dispatch, getState) => {
try {
const {
phone
} = getState().user
firebase.auth().signInWithPhoneNumber(phone)
.then(confirmResult => this.setState({
confirmResult,
message: 'Code has been sent!'
}))
.catch(error => this.setState({
message: `Sign In With Phone Number Error:
${error.message}`
}));
dispatch(getUser(response.user.uid))
} catch (e) {
alert(e)
}
if (response.user.uid) {
console.log(user)
alert(error.message)
const user = {
uid: response.user.uid,
phone: phone
}
db.collection('users')
.doc(response.user.uid)
.set(user)
dispatch({
type: PHONE,
payload: user
})
}
}
}
我没有任何错误。