Add AbortController polyfill to captcha script (#6555)

GitOrigin-RevId: 3a7e8350b4d6d62583a3cb87378605f13cde3728
This commit is contained in:
Alf Eaton 2022-02-04 09:23:15 +00:00 committed by Copybot
parent ae7c7edc69
commit e73ad85d0e

View file

@ -1,3 +1,4 @@
import 'abort-controller/polyfill'
import { postJSON } from '../../infrastructure/fetch-json'
const grecaptcha = window.grecaptcha
@ -6,13 +7,14 @@ let recaptchaId
const recaptchaCallbacks = []
export async function canSkipCaptcha(email) {
const controller = new AbortController()
const signal = controller.signal
const timer = setTimeout(() => {
controller.abort()
}, 1000)
let timer
let canSkip
try {
const controller = new AbortController()
const signal = controller.signal
timer = setTimeout(() => {
controller.abort()
}, 1000)
canSkip = await postJSON('/login/can-skip-captcha', {
signal,
body: { email },