Browse Source

fix: 退出登录获取label-studio地址

pull/244/head
cp3hnu 8 months ago
parent
commit
4a6f4d2120
1 changed files with 7 additions and 3 deletions
  1. +7
    -3
      react-ui/src/components/RightContent/AvatarDropdown.tsx

+ 7
- 3
react-ui/src/components/RightContent/AvatarDropdown.tsx View File

@@ -1,8 +1,9 @@
import { clearSessionToken } from '@/access'; import { clearSessionToken } from '@/access';
import { getLabelStudioUrl } from '@/services/developmentEnvironment';
import { setRemoteMenu } from '@/services/session'; import { setRemoteMenu } from '@/services/session';
import { logout } from '@/services/system/auth'; import { logout } from '@/services/system/auth';
import { ClientInfo } from '@/types'; import { ClientInfo } from '@/types';
import { sleep } from '@/utils/promise';
import { sleep, to } from '@/utils/promise';
import SessionStorage from '@/utils/sessionStorage'; import SessionStorage from '@/utils/sessionStorage';
import { oauthLogout } from '@/utils/ui'; import { oauthLogout } from '@/utils/ui';
import { LogoutOutlined, UserOutlined } from '@ant-design/icons'; import { LogoutOutlined, UserOutlined } from '@ant-design/icons';
@@ -63,7 +64,10 @@ const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu }) => {
* 退出登录,并且将当前的 url 保存 * 退出登录,并且将当前的 url 保存
*/ */
const loginOut = async () => { const loginOut = async () => {
oauthLogout('http://172.20.32.197:31209/oauth/logout');
const [res] = await to(getLabelStudioUrl());
if (res && res.data) {
oauthLogout(`${res.data}/oauth/logout`);
}
// 至少 1 秒后跳转,希望子系统能完成注销 // 至少 1 秒后跳转,希望子系统能完成注销
await Promise.all([logout(), sleep(1000)]); await Promise.all([logout(), sleep(1000)]);
clearSessionToken(); clearSessionToken();
@@ -76,7 +80,7 @@ const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu }) => {
} }
// setTimeout(() => { // setTimeout(() => {
// gotoLoginPage(); // gotoLoginPage();
// }, 1000);
// }, 100);
}; };
const actionClassName = useEmotionCss(({ token }) => { const actionClassName = useEmotionCss(({ token }) => {
return { return {


Loading…
Cancel
Save