fix: captcha plugin params changed (#904)
This commit is contained in:
@@ -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';
|
||||
/**
|
||||
* Note:Please set at least either of the `slug_name` and `type` attributes, otherwise no plugins will be rendered.
|
||||
*
|
||||
|
||||
@@ -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 };
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user