Commit 1585d6e1 authored by nanahira's avatar nanahira

refresh vaptcha obj

parent f50e37f5
Pipeline #28212 canceled with stages
in 18 seconds
...@@ -23,14 +23,16 @@ async function checkStatus(response) { ...@@ -23,14 +23,16 @@ async function checkStatus(response) {
} }
let vaptchaObj = null; let vaptchaObj = null;
vaptcha({ function refreshVaptchaObject() {
vid: '668bf0efd3784602950e94a8', vaptcha({
type: 'invisible', vid: '668bf0efd3784602950e94a8',
scene: 0, type: 'invisible',
area: 'auto', scene: 0,
}).then((v) => { area: 'auto',
vaptchaObj = v; }).then((v) => {
}); vaptchaObj = v;
});
}
/** /**
* Requests a URL, returning a promise. * Requests a URL, returning a promise.
...@@ -52,11 +54,12 @@ export default function request(relativeUrl, options) { ...@@ -52,11 +54,12 @@ export default function request(relativeUrl, options) {
'x-vaptcha-token': token.token, 'x-vaptcha-token': token.token,
}; };
request(relativeUrl, options).then(resolve).catch(reject); request(relativeUrl, options).then(resolve).catch(reject);
vaptchaObj.reset(); refreshVaptchaObject();
}); });
vaptchaObj.listen('close', () => { vaptchaObj.listen('close', () => {
console.log('vaptcha close'); console.log('vaptcha close');
reject(new Error('vaptcha close')); reject(new Error('vaptcha close'));
refreshVaptchaObject();
}) })
vaptchaObj.validate(); vaptchaObj.validate();
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment