diff --git a/ui/src/utils/pluginKit/index.ts b/ui/src/utils/pluginKit/index.ts index 6d0e9878a..12cd02479 100644 --- a/ui/src/utils/pluginKit/index.ts +++ b/ui/src/utils/pluginKit/index.ts @@ -25,6 +25,7 @@ import type * as Type from '@/common/interface'; import { LOGGED_TOKEN_STORAGE_KEY } from '@/common/constants'; import { getPluginsStatus } from '@/services'; import Storage from '@/utils/storage'; +import request from '@/utils/request'; import { initI18nResource } from './utils'; import { Plugin, PluginInfo, PluginType } from './interface'; @@ -227,7 +228,7 @@ const useRenderHtmlPlugin = ( }) .forEach((plugin) => { plugin.hooks?.useRender?.forEach((hook) => { - hook(element); + hook(element, request); }); }); }; @@ -247,7 +248,7 @@ const useRenderPlugin = ( }) .forEach((plugin) => { plugin.hooks?.useRender?.forEach((hook) => { - hook(element); + hook(element, request); }); }); }; diff --git a/ui/src/utils/pluginKit/interface.ts b/ui/src/utils/pluginKit/interface.ts index 880a524a5..d946ed6ee 100644 --- a/ui/src/utils/pluginKit/interface.ts +++ b/ui/src/utils/pluginKit/interface.ts @@ -20,6 +20,7 @@ import { NamedExoticComponent, FC, RefObject } from 'react'; import type * as Type from '@/common/interface'; +import Request from '@/utils/request'; export enum PluginType { Connector = 'connector', @@ -44,7 +45,10 @@ export interface Plugin { i18nConfig?; hooks?: { useRender?: Array< - (element: HTMLElement | RefObject | null) => void + ( + element: HTMLElement | RefObject | null, + request?: typeof Request, + ) => void >; useCaptcha?: (props: { captchaKey: Type.CaptchaKey; commonProps: any }) => { getCaptcha: () => Record;