mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-24 23:04:00 +08:00
added callback function to captcha controller
This commit is contained in:
parent
6fd6cdf55b
commit
6ab9a44ed2
1 changed files with 6 additions and 1 deletions
|
@ -2,13 +2,18 @@ const siteKey = "6Lc-V8McAAAAAJ7s6LGNe7MBZnRiwbsbiWts87aj";
|
|||
|
||||
const captchas: Record<string, number> = {};
|
||||
|
||||
export function render(element: HTMLElement, id: string): void {
|
||||
export function render(
|
||||
element: HTMLElement,
|
||||
id: string,
|
||||
callback?: (data: any) => void
|
||||
): void {
|
||||
if (captchas[id] !== undefined && captchas[id] !== null) {
|
||||
return;
|
||||
}
|
||||
|
||||
const widgetId = grecaptcha.render(element, {
|
||||
sitekey: siteKey,
|
||||
callback,
|
||||
});
|
||||
|
||||
captchas[id] = widgetId;
|
||||
|
|
Loading…
Reference in a new issue