Skip to content

Commit 9fc73c7

Browse files
committed
fix
1 parent cc1fdc8 commit 9fc73c7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

web_src/js/features/captcha.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,17 @@ export async function initCaptcha() {
3434
break;
3535
}
3636
case 'm-captcha': {
37-
const {default: mCaptcha} = await import(/* webpackChunkName: "mcaptcha-vanilla-glue" */'@mcaptcha/vanilla-glue');
38-
// @ts-expect-error
37+
const mCaptcha = await import(/* webpackChunkName: "mcaptcha-vanilla-glue" */'@mcaptcha/vanilla-glue');
38+
39+
// FIXME: the mCaptcha code is not right, it's a miracle that the wrong code could run
40+
// * the "vanilla-glue" has some problems with es6 module.
41+
// * the INPUT_NAME is a "const", it should not be changed.
42+
// * the "mCaptcha.default" is actually the "Widget".
43+
3944
mCaptcha.INPUT_NAME = 'm-captcha-response';
4045
const instanceURL = captchaEl.getAttribute('data-instance-url');
4146

42-
// @ts-expect-error
43-
mCaptcha.default({
47+
new mCaptcha.default({
4448
siteKey: {
4549
instanceUrl: new URL(instanceURL),
4650
key: siteKey,

0 commit comments

Comments
 (0)