Browse Source

chore: remove deprecated deps (#11423)

pull/11477/head
jiaxiang 10 months ago
committed by GitHub
parent
commit
dd195d5aa8
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 3
      package.json
  2. 8
      src/components/RightContent/AvatarDropdown.tsx

3
package.json

@ -45,7 +45,6 @@
"antd-style": "^3.7.0", "antd-style": "^3.7.0",
"classnames": "^2.5.1", "classnames": "^2.5.1",
"dayjs": "^1.11.13", "dayjs": "^1.11.13",
"querystring": "^0.2.1",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1" "react-dom": "^18.3.1"
}, },
@ -55,9 +54,7 @@
"@commitlint/config-conventional": "^19.5.0", "@commitlint/config-conventional": "^19.5.0",
"@testing-library/dom": "^10.4.0", "@testing-library/dom": "^10.4.0",
"@testing-library/react": "^16.0.1", "@testing-library/react": "^16.0.1",
"@types/classnames": "^2.3.1",
"@types/express": "^4.17.21", "@types/express": "^4.17.21",
"@types/history": "^5.0.0",
"@types/jest": "^29.5.13", "@types/jest": "^29.5.13",
"@types/lodash": "^4.17.10", "@types/lodash": "^4.17.10",
"@types/react": "^18.3.11", "@types/react": "^18.3.11",

8
src/components/RightContent/AvatarDropdown.tsx

@ -4,7 +4,6 @@ import { history, useModel } from '@umijs/max';
import { Spin } from 'antd'; import { Spin } from 'antd';
import type { MenuProps } from 'antd'; import type { MenuProps } from 'antd';
import { createStyles } from 'antd-style'; import { createStyles } from 'antd-style';
import { stringify } from 'querystring';
import React from 'react'; import React from 'react';
import { flushSync } from 'react-dom'; import { flushSync } from 'react-dom';
import HeaderDropdown from '../HeaderDropdown'; import HeaderDropdown from '../HeaderDropdown';
@ -46,15 +45,16 @@ export const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu, childre
await outLogin(); await outLogin();
const { search, pathname } = window.location; const { search, pathname } = window.location;
const urlParams = new URL(window.location.href).searchParams; const urlParams = new URL(window.location.href).searchParams;
const searchParams = new URLSearchParams({
redirect: pathname + search,
});
/** 此方法会跳转到 redirect 参数所在的位置 */ /** 此方法会跳转到 redirect 参数所在的位置 */
const redirect = urlParams.get('redirect'); const redirect = urlParams.get('redirect');
// Note: There may be security issues, please note // Note: There may be security issues, please note
if (window.location.pathname !== '/user/login' && !redirect) { if (window.location.pathname !== '/user/login' && !redirect) {
history.replace({ history.replace({
pathname: '/user/login', pathname: '/user/login',
search: stringify({ search: searchParams.toString(),
redirect: pathname + search,
}),
}); });
} }
}; };

Loading…
Cancel
Save