Commit aad83c4e authored by nano's avatar nano

fix network error

parent c5d1df44
......@@ -40,6 +40,7 @@ function UserPanel({ dispatch, user }) {
style={{ borderRadius: '45px',
height: '45px',
weight: '45px',
boxSizing: 'content-box',
border: '2px solid rgba(255,255,255,0.2' }} />
</div>
</Dropdown>
......
......@@ -168,15 +168,16 @@ export default {
message.success(messages['Your-account-has-been-successfully-activated!'], 3);
}
} catch (error) {
message.error(error.message, 3);
message.error(messages[error.message] || error.message, 3);
}
},
*checkEmail({ payload }, { call, put }) {
*checkEmail({ payload }, { call, put, select }) {
if (!payload.email) {
yield put({ type: 'check', payload: { checkEmail: 'error' } });
return;
}
const { messages } = yield select(state => state.common);
try {
const { data } = yield call(checkUserExists, {
email: payload.email,
......@@ -186,15 +187,20 @@ export default {
yield put({ type: 'check', payload: { isEmailExists: true, checkEmail: 'warning' } });
}
} catch (error) {
yield put({ type: 'check', payload: { isEmailExists: false, checkEmail: 'success' } });
if (error.message === 'i_not_found') {
yield put({ type: 'check', payload: { isEmailExists: false, checkEmail: 'success' } });
} else {
message.error(messages[error.message] || error.message, 3);
}
}
},
*checkUsername({ payload }, { call, put }) {
*checkUsername({ payload }, { call, put, select }) {
if (!payload.username) {
yield put({ type: 'check', payload: { checkUsername: 'error' } });
return;
}
const { messages } = yield select(state => state.common);
try {
const { data } = yield call(checkUserExists, {
username: payload.username,
......@@ -204,7 +210,11 @@ export default {
yield put({ type: 'check', payload: { isUserNameExists: true, checkUsername: 'warning' } });
}
} catch (error) {
yield put({ type: 'check', payload: { isUserNameExists: false, checkUsername: 'success' } });
if (error.message === 'i_not_found') {
yield put({ type: 'check', payload: { isUserNameExists: false, checkUsername: 'success' } });
} else {
message.error(messages[error.message] || error.message, 3);
}
}
},
*login({ payload }, { call, put, select }) {
......
import { Alert, Form, Icon, Input, Spin, Steps, Tag } from 'antd';
import { Alert, Form, Icon, Input, Spin, Steps, Tag, Breadcrumb } from 'antd';
import { connect } from 'dva';
import { routerRedux } from 'dva/router';
import React, { PropTypes } from 'react';
......@@ -68,9 +68,7 @@ class Verify extends React.Component {
return (
<div
style={{ display: 'flex', flex: 1, justifyContent: 'center', alignItems: 'center', height: '100%' }}
>
<div style={{ display: 'flex', flex: 1, justifyContent: 'center', alignItems: 'center', height: '100%' }}>
<Spin spinning={loading} delay={100}>
<Steps size="large" current={1}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment