Skip to content

Commit

Permalink
✅ test: 修正测试
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Nov 28, 2021
1 parent 50b6e7e commit 74e0652
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 17 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions packages/user-panel/demos/LoginWithFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const LoginWithFooter = () => {
onWechatLoginClick={() => {
message.info('微信登录实现方法');
}}
onRegisterClick={(history) => {
history.push('/components/biz/user-panel#显示底部');
onRegisterClick={(navigate) => {
navigate('/components/biz/user-panel#显示底部');
}}
/>
</div>
Expand Down
4 changes: 2 additions & 2 deletions packages/user-panel/demos/LoginWithForgotUrl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ const LoginWithLogo = () => {
}}
>
<UserPanel.Login
onForgotClick={(history) => {
history.push('/components/biz/user-panel');
onForgotClick={(navigate) => {
navigate('/components/biz/user-panel');
}}
/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/user-panel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"dependencies": {
"@arvinxu/i18n": "1.0.1",
"classnames": "^2.3.1",
"react-router": "*"
"react-router": "^6.0.2"
},
"peerDependencies": {
"@ant-design/icons": "^4.x",
Expand Down
11 changes: 6 additions & 5 deletions packages/user-panel/src/components/Footer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';
import type { FC } from 'react';
import type * as H from 'history';
import { useHistory } from 'react-router';
import type { NavigateFunction } from 'react-router';
import { useNavigate } from 'react-router';

import { Typography, Divider } from 'antd';

import WechatLogin from '../WechatLogin';
Expand All @@ -26,7 +27,7 @@ export interface FooterProps {
/**
* @title 注册页面 Url
*/
onRegisterClick?: (history: H.History) => void;
onRegisterClick?: (navigate: NavigateFunction) => void;
}

export const Footer: FC<FooterProps> = ({
Expand All @@ -36,12 +37,12 @@ export const Footer: FC<FooterProps> = ({
}) => {
const f = useFormatMessage();

const history = useHistory();
const navigate = useNavigate();

const onClick = () => {
switch (type) {
case 'login':
onRegisterClick?.(history);
onRegisterClick?.(navigate);
break;
case 'register':
break;
Expand Down
15 changes: 8 additions & 7 deletions packages/user-panel/src/login/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ import ProForm, {
ProFormCheckbox,
ProFormText,
} from '@ant-design/pro-form';
import type { NavigateFunction } from 'react-router';
import { useNavigate } from 'react-router';

import LoginErrorMessage from './LoginErrorMessage';

import './index.less';
import { useFormatMessage } from '../components';
import type { IUserLogin } from '../types';
import * as H from 'history';
import { useHistory } from 'react-router';
import { useFormatMessage } from '../components';
import './index.less';

export interface LoginProps {
/**
Expand All @@ -35,7 +36,7 @@ export interface LoginProps {
/**
* 忘记密码 url
*/
onForgotClick?: (history: H.History) => void;
onForgotClick?: (navigate: NavigateFunction) => void;
}

const Login: React.FC<LoginProps> = (props) => {
Expand All @@ -48,7 +49,7 @@ const Login: React.FC<LoginProps> = (props) => {
const { status, type: loginType } = loginStatus;

const f = useFormatMessage();
const history = useHistory();
const navigate = useNavigate();

return (
<div className="avx-user-panel-login-container">
Expand Down Expand Up @@ -207,7 +208,7 @@ const Login: React.FC<LoginProps> = (props) => {
float: 'right',
}}
onClick={() => {
onForgotClick(history);
onForgotClick(navigate);
}}
>
{f('login.forgotPassword')}
Expand Down

1 comment on commit 74e0652

@vercel
Copy link

@vercel vercel bot commented on 74e0652 Nov 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.