diff --git a/react-ui/src/components/IFramePage/index.tsx b/react-ui/src/components/IFramePage/index.tsx index 92fd34d5..e431e3e8 100644 --- a/react-ui/src/components/IFramePage/index.tsx +++ b/react-ui/src/components/IFramePage/index.tsx @@ -4,6 +4,7 @@ import { getLabelStudioUrl } from '@/services/developmentEnvironment'; import { generateSign } from '@/utils'; import { to } from '@/utils/promise'; import SessionStorage from '@/utils/sessionStorage'; +import { useModel } from '@umijs/max'; import classNames from 'classnames'; import { useEffect, useState } from 'react'; import { createPortal } from 'react-dom'; @@ -16,13 +17,12 @@ export enum IframePageType { GitLink = 'GitLink', } -const getRequestAPI = (type: IframePageType): (() => Promise) => { +const getRequestAPI = (type: IframePageType, loginName: string): (() => Promise) => { switch (type) { case IframePageType.DatasetAnnotation: return getLabelStudioUrl; case IframePageType.AppDevelopment: { // return () => Promise.resolve({ code: 200, data: 'http://172.20.32.185:30080/' }); - const loginName = 'test3'; const sign = generateSign(loginName); return () => @@ -31,7 +31,6 @@ const getRequestAPI = (type: IframePageType): (() => Promise) => { data: `http://10.43.107.27:24078/uap/nudt/sso/login?name=${loginName}&sign=${sign}`, }); } - case IframePageType.DevEnv: return () => Promise.resolve({ @@ -52,6 +51,9 @@ type IframePageProps = { function IframePage({ type, className, style }: IframePageProps) { const [iframeUrl, setIframeUrl] = useState(''); const [loading, setLoading] = useState(false); + const { initialState } = useModel('@@initialState'); + const { currentUser } = initialState || {}; + useEffect(() => { requestIframeUrl(); return () => { @@ -62,7 +64,7 @@ function IframePage({ type, className, style }: IframePageProps) { }, []); const requestIframeUrl = async () => { setLoading(true); - const [res] = await to(getRequestAPI(type)()); + const [res] = await to(getRequestAPI(type, currentUser?.userName || '')()); if (res && res.data) { setIframeUrl(res.data); } else { diff --git a/react-ui/src/pages/Authorize/index.tsx b/react-ui/src/pages/Authorize/index.tsx index f3624f32..e42a0f1b 100644 --- a/react-ui/src/pages/Authorize/index.tsx +++ b/react-ui/src/pages/Authorize/index.tsx @@ -22,7 +22,6 @@ function Authorize() { code, }; const [res] = await to(loginByOauth2Req(params)); - debugger; if (res && res.data) { const { access_token, expires_in } = res.data; setSessionToken(access_token, access_token, expires_in);