Browse Source

fix: redirect use react router pathname

pull/10257/head
chenshuai2144 4 years ago
parent
commit
00151a634b
  1. 7
      src/components/RightContent/AvatarDropdown.tsx

7
src/components/RightContent/AvatarDropdown.tsx

@ -13,13 +13,14 @@ export type GlobalHeaderRightProps = {
menu?: boolean; menu?: boolean;
}; };
const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu }) => {
/** /**
* 退 url * 退 url
*/ */
const loginOut = async () => { const loginOut = async () => {
await outLogin(); await outLogin();
const { search, pathname } = window.location; const { search, pathname } = history.location;
const urlParams = new URL(window.location.href).searchParams; const urlParams = new URL(history.location.search).searchParams;
/** 此方法会跳转到 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
@ -32,8 +33,6 @@ const loginOut = async () => {
}); });
} }
}; };
const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu }) => {
const { initialState, setInitialState } = useModel('@@initialState'); const { initialState, setInitialState } = useModel('@@initialState');
const onMenuClick = useCallback( const onMenuClick = useCallback(

Loading…
Cancel
Save