Browse Source

feat: show error info in toast when login failed

pull/1/head
kdxcxs 4 years ago
parent
commit
fe8683d46b
  1. 4
      src/component/YooLogin.js
  2. 4
      src/ui/YooLoginUI.js

4
src/component/YooLogin.js

@ -46,13 +46,13 @@ export default class YooLogin extends Component {
})
.then((response) => {
if (/<title>(.|\n)*用户登录(.|\n)*<\/title>/.test(response)) {
onFail();
onFail('用户名或密码错误');
CookieManager.clearAll();
} else if (/<title>(.|\n)*网络课程(.|\n)*<\/title>/.test(response)) {
this.props.gotoForum();
}
})
.catch(onFail);
.catch(() => onFail('登陆失败'));
}
render() {

4
src/ui/YooLoginUI.js

@ -63,9 +63,9 @@ export default class YooLoginUI extends Component {
}
}
onLoginFailed() {
onLoginFailed(hint) {
this.setState({loading: false});
ToastAndroid.show('登录失败', ToastAndroid.SHORT);
ToastAndroid.show(hint, ToastAndroid.SHORT);
}
render() {

Loading…
Cancel
Save