This commit is contained in:
archer
2023-07-18 16:26:57 +08:00
parent 2330186a09
commit a993eba7f0
13 changed files with 45 additions and 42 deletions

View File

@@ -2,11 +2,11 @@ import axios from 'axios';
import { Obj2Query } from '../tools';
export const getClientToken = (googleVerKey: string) => {
if (typeof grecaptcha === 'undefined' || !grecaptcha?.ready) return '';
if (typeof window.grecaptcha === 'undefined' || !window.grecaptcha?.ready) return '';
return new Promise<string>((resolve, reject) => {
grecaptcha.ready(async () => {
window.grecaptcha.ready(async () => {
try {
const token = await grecaptcha.execute(googleVerKey, {
const token = await window.grecaptcha.execute(googleVerKey, {
action: 'submit'
});
resolve(token);