Firebase RecaptchaVerifier.clear() has no effect

前端 未结 4 1169
旧巷少年郎
旧巷少年郎 2021-01-15 01:18

I have react web app where I want to implement phone auth. I have initialized recaptchaVerifier based on docs and examples. However if I want to submit the form again (say

4条回答
  •  北荒
    北荒 (楼主)
    2021-01-15 01:56

    Just use window.recaptchaVerifier.reset() inside catch eg

    const signInWithPhoneNumber = (fullMobile) => {
    return new Promise((resolve, reject) => {
      auth.signInWithPhoneNumber(fullMobile, window.recaptchaVerifier).then(res => {
        resolve(res)
      })
        .catch(error => {
          console.log(error)
          window.recaptchaVerifier.reset()
          reject(error)
        })
    })
    

    }

提交回复
热议问题