Commit f6c98b2e authored by 2breakegg's avatar 2breakegg

reformat code

parent e32291a9
......@@ -99,7 +99,7 @@ class EmailForm extends React.Component {
}
function mapStateToProps(state, props) {
function mapStateToProps(state) {
const {
user: { user },
auth: { isEmailExists, checkEmail },
......
......@@ -72,7 +72,7 @@ class EmailForm extends React.Component {
}
function mapStateToProps(state, props) {
function mapStateToProps(state) {
const {
user: { user },
auth: { isEmailExists, checkEmail, isSendEmailActive },
......
......@@ -166,7 +166,6 @@ export default {
}
},
*checkEmail({ payload }, { call, put }) {
if (!payload.email) {
yield put({ type: 'check', payload: { checkEmail: 'error' } });
return;
......
......@@ -17,7 +17,7 @@ export default {
effects: {},
subscriptions: {
setup({ dispatch }) {
let language = localStorage.getItem('locale') || navigator.language || (navigator.languages && navigator.languages[0]) || navigator.userLanguage;
const language = localStorage.getItem('locale') || navigator.language || (navigator.languages && navigator.languages[0]) || navigator.userLanguage;
const languageWithoutRegionCode = language.toLowerCase().split(/[_-]+/)[0];
const messages = i18n[languageWithoutRegionCode];
......
......@@ -118,7 +118,7 @@ export default {
const { token } = payload;
try {
let { data } = yield call(getAuthUser, { token });
const { data } = yield call(getAuthUser, { token });
if (data) {
yield put({ type: 'getAuthUserSuccess', payload: { user: data, token } });
}
......@@ -135,7 +135,7 @@ export default {
}
try {
let { data } = yield call(getAuthUser, { token });
const { data } = yield call(getAuthUser, { token });
if (data) {
if (handleSSO(data)) {
return;
......@@ -155,10 +155,10 @@ export default {
*updateProfile({ payload }, { call, put, select }) {
message.destroy();
let token = yield select(state => state.user.token);
let { messages } = yield select(state => state.common);
const token = yield select(state => state.user.token);
const { messages } = yield select(state => state.common);
try {
let { data } = yield call(updateProfile, { ...payload, token });
const { data } = yield call(updateProfile, { ...payload, token });
if (data) {
yield put({ type: 'updateProfileSuccess', payload: { user: data, token } });
......@@ -170,10 +170,10 @@ export default {
}
},
*updateEmail({ payload }, { call, put, select }) {
let { messages } = yield select(state => state.common);
const { messages } = yield select(state => state.common);
try {
let token = yield select(state => state.user.token);
let { data } = yield call(updateAccount, { ...payload, token });
const token = yield select(state => state.user.token);
const { data } = yield call(updateAccount, { ...payload, token });
if (data) {
yield put({ type: 'updateAccountSuccess', payload: { user: data, token } });
message.info(messages['A-verification-email-has-been-sent-to-you,please-check-the-mail-to-complete.']);
......@@ -185,10 +185,10 @@ export default {
},
*updateAccount({ payload }, { call, put, select }) {
let { messages } = yield select(state => state.common);
const { messages } = yield select(state => state.common);
try {
let token = yield select(state => state.user.token);
let { data } = yield call(updateAccount, { ...payload, token });
const token = yield select(state => state.user.token);
const { data } = yield call(updateAccount, { ...payload, token });
if (data) {
yield put({ type: 'updateAccountSuccess', payload: { user: data, token } });
message.info(messages.update_success);
......@@ -201,12 +201,12 @@ export default {
},
subscriptions: {
setup({ dispatch, history }) {
let token = localStorage.getItem('token');
const token = localStorage.getItem('token');
if (token) {
dispatch({ type: 'getAuthUser', payload: { token } });
}
history.listen(({ pathname }) => {
if (pathname == '/') {
if (pathname === '/') {
dispatch({ type: 'preLogin', payload: { token } });
}
});
......
......@@ -24,10 +24,7 @@ class Active extends React.Component {
}
function mapStateToProps(state) {
const {} = state;
const loading = state.loading.global || false;
return {
loading,
};
......
import { Button, Form, Icon, Input, Select, Spin, Steps } from 'antd';
import { Button, Form, Icon, Input, Spin, Steps } from 'antd';
import { connect } from 'dva';
import { Link } from 'dva/router';
import React, { PropTypes } from 'react';
......
......@@ -126,7 +126,7 @@ const particleConfig = {
function Index({ children, messages }) {
return (
<div style={{ display: 'flex', flexDirection: 'column', flex: 1, height: '100vh' }}>
<DocumentTitle title={messages['title'] || 'Moe Cube'} />
<DocumentTitle title={messages.title || 'Moe Cube'} />
<Header style={{ display: 'flex', alignItems: 'center' }}>
<Link to="/" style={{ marginTop: '20px' }}>
......
......@@ -41,11 +41,9 @@ class Profiles extends React.Component {
console.log(blob);
this.props.dispatch({ type: 'upload/upload', payload: { image: blob, user_id: id } });
});
};
onGetFile = (e) => {
let files;
if (e.dataTransfer) {
files = e.dataTransfer.files;
......@@ -75,9 +73,9 @@ class Profiles extends React.Component {
};
render() {
const { dispatch, form, user, loading, progress, status, imageUrl, isUpload, uploadedImage } = this.props;
const { dispatch, form, user, loading, imageUrl, isUpload } = this.props;
const { getFieldDecorator } = form;
const { username, name, id, avatar } = user;
const { name, avatar } = user;
const { intl: { messages } } = this.context;
const nameProps = {
......@@ -93,12 +91,6 @@ class Profiles extends React.Component {
},
};
const crop = {
maxHeight: 80,
width: 30,
aspect: 16 / 16,
};
return (
<Spin spinning={loading} delay={100}>
......@@ -127,19 +119,20 @@ class Profiles extends React.Component {
}} style={{ display: 'none' }}/>
</label>
</Button>
<Button type="primary" onClick={ this.handleUpload}>
<Button type="primary" onClick={this.handleUpload}>
<Icon type="upload"/> upload
</Button>
</div>
:
<img src={ avatar || imageUrl || defaultAvatar }
onClick={() => dispatch({ type: 'upload/start' })}/>
<img src={avatar || imageUrl || defaultAvatar}
onClick={() => dispatch({ type: 'upload/start' })}
/>
}
</FormItem>
<FormItem {...nameProps.fromItem}>
{getFieldDecorator(`name`, { ...nameProps.decorator })(
{getFieldDecorator('name', { ...nameProps.decorator })(
<Input {...nameProps.input} />,
)}
</FormItem>
......
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