fix: captcha plugin params changed (#904)

This commit is contained in:
dashuai
2024-04-09 18:37:02 +08:00
committed by GitHub
parent 38edc4eb54
commit 7a5fabaeae
3 changed files with 6 additions and 4 deletions
+1 -2
View File
@@ -19,8 +19,7 @@
import React, { FC, ReactNode } from 'react';
import PluginKit, { Plugin } from '@/utils/pluginKit';
import type { PluginType } from '@/utils/pluginKit/interface';
import PluginKit, { Plugin, PluginType } from '@/utils/pluginKit';
/**
* NotePlease set at least either of the `slug_name` and `type` attributes, otherwise no plugins will be rendered.
*
+4 -1
View File
@@ -190,7 +190,10 @@ const useCaptchaPlugin = (key: Type.CaptchaKey) => {
.getPlugins()
.filter((plugin) => plugin.info.type === 'captcha' && plugin.activated);
const pluginHooks = plugins.getOnePluginHooks(captcha[0]?.info.slug_name);
return pluginHooks?.useCaptcha?.(key);
return pluginHooks?.useCaptcha?.({
captchaKey: key,
commonProps: defaultProps(),
});
};
export type { Plugin, PluginInfo, PluginType };
+1 -1
View File
@@ -57,7 +57,7 @@ export interface Plugin {
i18nConfig?;
hooks?: {
useRender?: Array<(element: HTMLElement | null) => void>;
useCaptcha?: (key: Type.CaptchaKey) => {
useCaptcha?: (props: { captchaKey: Type.CaptchaKey; commonProps: any }) => {
getCaptcha: () => Record<string, any>;
check: (t: () => void) => void;
handleCaptchaError: (error) => any;