Skip to content

Commit

Permalink
fix(用户登录): 验证码优化
Browse files Browse the repository at this point in the history
登录失败时自动刷新验证码

fix #205
  • Loading branch information
Lind-pro committed Sep 16, 2020
1 parent aaa1d60 commit fb12171
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/models/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const Model: LoginModelType = {
},

effects: {
*login({ payload }, { call, put }) {
*login({ payload, callback }, { call, put }) {
const response = yield call(apis.login.login, payload);
yield put({
type: 'changeLoginStatus',
Expand Down Expand Up @@ -75,7 +75,9 @@ const Model: LoginModelType = {
// yield put(routerRedux.replace(redirect || '/'));
router.replace(redirect || '/');
// router.replace('/');
}
} else (
callback()
)
},

*logout(_, { call, put }) {
Expand Down
1 change: 1 addition & 0 deletions src/pages/user/login2/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const Login: React.FC<Props> = props => {
dispatch({
type: 'login/login',
payload: { username, password, expires, tokenType: 'default', verifyKey: captcha, verifyCode: code },
callback: () => { getCodeImg() }
});
};

Expand Down

0 comments on commit fb12171

Please sign in to comment.