fix: 注册失败提示

pull/100/head
bigfengyu 5 years ago
parent da9a9f996a
commit f962e587e6

@ -0,0 +1,27 @@
@import "../../assets/variables.sass";
// 水平居中 + 垂直居中
.wrapper
background-size: cover;
width: 100%
height: 100%
min-height: 800px
.LoginForm
position: fixed;
left: 50%;
top: 30%;
width: 25rem;
margin-left: -12.5rem;
margin-top: -135px;
border: 1px solid #E6E6E6;
border-radius: .5rem;
.header
padding: 1.5rem 3rem;
border-bottom: 1px solid $border;
.title
font-size: 2rem;
.body
padding: 1.5rem 3rem;
.footer
padding: 1.5rem 3rem;
border-top: 1px solid $border;

@ -92,8 +92,10 @@ class RegisterForm extends Component<Props, State> {
handleSubmit = (e: any) => {
const { onAddUser } = this.props
e.preventDefault()
onAddUser(this.state, () => {
onAddUser(this.state, (isOk: boolean) => {
if (isOk) {
window.location.href = '/'
}
})
};
}

@ -101,7 +101,9 @@ const relatives = {
*[AccountAction.addUser(null, null).type](action: any) {
try {
const user = yield call(AccountService.addUser, action.user)
let isOk = false
if (user && user.id) {
isOk = true
yield put(AccountAction.addUserSucceeded(user))
try {
const user = yield call(AccountService.fetchLoginInfo)
@ -113,10 +115,11 @@ const relatives = {
}
yield put(push('/'))
} else {
yield put(showMessage(`注册失败:${user.errMsg}`, MSG_TYPE.ERROR))
yield put(AccountAction.addUserFailed('注册失败'))
}
if (action.onResolved) {
action.onResolved()
action.onResolved(isOk)
}
} catch (e) {
yield put(AccountAction.addUserFailed(e.message))

Loading…
Cancel
Save