Kylin
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
3 additions and
4 deletions
-
src/components/RightContent/AvatarDropdown.tsx
-
src/pages/User/Login/index.tsx
|
|
|
@ -19,8 +19,8 @@ const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu }) => { |
|
|
|
*/ |
|
|
|
const loginOut = async () => { |
|
|
|
await outLogin(); |
|
|
|
const { search, pathname } = history.location; |
|
|
|
const urlParams = new URL(history.location.search).searchParams; |
|
|
|
const { search, pathname } = window.location; |
|
|
|
const urlParams = new URL(window.location.href).searchParams; |
|
|
|
/** 此方法会跳转到 redirect 参数所在的位置 */ |
|
|
|
const redirect = urlParams.get('redirect'); |
|
|
|
// Note: There may be security issues, please note
|
|
|
|
|
|
|
|
@ -38,7 +38,7 @@ const LoginMessage: React.FC<{ |
|
|
|
const Login: React.FC = () => { |
|
|
|
const [userLoginState, setUserLoginState] = useState<API.LoginResult>({}); |
|
|
|
const [type, setType] = useState<string>('account'); |
|
|
|
const { initialState, refresh, setInitialState } = useModel('@@initialState'); |
|
|
|
const { initialState, setInitialState } = useModel('@@initialState'); |
|
|
|
|
|
|
|
const intl = useIntl(); |
|
|
|
|
|
|
|
@ -63,7 +63,6 @@ const Login: React.FC = () => { |
|
|
|
}); |
|
|
|
message.success(defaultLoginSuccessMessage); |
|
|
|
await fetchUserInfo(); |
|
|
|
await refresh(); |
|
|
|
const urlParams = new URL(window.location.href).searchParams; |
|
|
|
history.push(urlParams.get('redirect') || '/'); |
|
|
|
return; |
|
|
|
|