A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
fix: captcha plugin params changed (#904)
dashuai7a5fabaeae78
diff --git a/ui/src/components/PluginRender/index.tsx b/ui/src/components/PluginRender/index.tsxindex 2426eb9c..3da9fd0b 100644--- a/ui/src/components/PluginRender/index.tsx+++ b/ui/src/components/PluginRender/index.tsx@@ -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.*diff --git a/ui/src/utils/pluginKit/index.ts b/ui/src/utils/pluginKit/index.tsindex 3b9eaadb..87851d80 100644--- a/ui/src/utils/pluginKit/index.ts+++ b/ui/src/utils/pluginKit/index.ts@@ -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 };diff --git a/ui/src/utils/pluginKit/utils.ts b/ui/src/utils/pluginKit/utils.tsindex a6ca44ce..2116e636 100644--- a/ui/src/utils/pluginKit/utils.ts+++ b/ui/src/utils/pluginKit/utils.ts@@ -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;