diff --git a/client/web/plugins/com.msgbyte.openapi/src/MainPanel/AppInfo/OAuth.tsx b/client/web/plugins/com.msgbyte.openapi/src/MainPanel/AppInfo/OAuth.tsx index c4c08d2e..32dba9e8 100644 --- a/client/web/plugins/com.msgbyte.openapi/src/MainPanel/AppInfo/OAuth.tsx +++ b/client/web/plugins/com.msgbyte.openapi/src/MainPanel/AppInfo/OAuth.tsx @@ -6,7 +6,7 @@ import { } from '@capital/component'; import { useOpenAppInfo } from '../context'; import { OpenAppCapability } from '../types'; -import { postRequest, useAsyncRequest } from '@capital/common'; +import { postRequest, useAsyncFn, useAsyncRequest } from '@capital/common'; const OAuth: React.FC = React.memo(() => { const { refresh, appId, capability, oauth } = useOpenAppInfo(); diff --git a/client/web/plugins/com.msgbyte.openapi/src/MainPanel/context.tsx b/client/web/plugins/com.msgbyte.openapi/src/MainPanel/context.tsx index b25927d3..928a5bf4 100644 --- a/client/web/plugins/com.msgbyte.openapi/src/MainPanel/context.tsx +++ b/client/web/plugins/com.msgbyte.openapi/src/MainPanel/context.tsx @@ -8,10 +8,12 @@ interface OpenAppInfoContextProps extends OpenApp { const OpenAppInfoContext = React.createContext(null); OpenAppInfoContext.displayName = 'OpenAppInfoContext'; -export const OpenAppInfoProvider: React.FC<{ - appInfo: OpenApp; - refresh: OpenAppInfoContextProps['refresh']; -}> = (props) => { +export const OpenAppInfoProvider: React.FC< + React.PropsWithChildren<{ + appInfo: OpenApp; + refresh: OpenAppInfoContextProps['refresh']; + }> +> = (props) => { return ( { - const [show, setShow] = useState(false); - return ( - - {show ? ( - <> - {props.children} - setShow(false)} /> - - ) : ( - <> - ******** - setShow(true)} /> - - )} - - ); -}); +export const SecretValue: React.FC = React.memo( + (props) => { + const [show, setShow] = useState(false); + return ( + + {show ? ( + <> + {props.children} + setShow(false)} /> + + ) : ( + <> + ******** + setShow(true)} /> + + )} + + ); + } +); SecretValue.displayName = 'SecretValue'; diff --git a/client/web/plugins/com.msgbyte.openapi/src/components/ServiceChecker.tsx b/client/web/plugins/com.msgbyte.openapi/src/components/ServiceChecker.tsx index 5f1b8a77..2085785c 100644 --- a/client/web/plugins/com.msgbyte.openapi/src/components/ServiceChecker.tsx +++ b/client/web/plugins/com.msgbyte.openapi/src/components/ServiceChecker.tsx @@ -6,20 +6,22 @@ import { Translate } from '../translate'; /** * 服务监测 */ -export const ServiceChecker: React.FC = React.memo((props) => { - const { loading, value: enabled } = useAsync(async () => { - const services = await fetchAvailableServices(); - return services.includes('openapi.app'); - }, []); +export const ServiceChecker: React.FC = React.memo( + (props) => { + const { loading, value: enabled } = useAsync(async () => { + const services = await fetchAvailableServices(); + return services.includes('openapi.app'); + }, []); - if (loading) { - return ; - } + if (loading) { + return ; + } - if (!enabled) { - return
{Translate.noservice}
; - } + if (!enabled) { + return
{Translate.noservice}
; + } - return <>{props.children}; -}); + return <>{props.children}; + } +); ServiceChecker.displayName = 'ServiceChecker';