small refactoring

This commit is contained in:
SleepWalker 2016-05-28 00:36:22 +03:00
parent 0816e7a848
commit 232cf0465c
3 changed files with 24 additions and 25 deletions

View File

@ -8,7 +8,7 @@ import { LangMenu } from 'components/langMenu';
import styles from './footerMenu.scss'; import styles from './footerMenu.scss';
import messages from './footerMenu.intl.json'; import messages from './footerMenu.intl.json';
export default class FooterMenu extends Component { class FooterMenu extends Component {
static displayName = 'FooterMenu'; static displayName = 'FooterMenu';
static propTypes = { static propTypes = {

View File

@ -1,7 +1,6 @@
import React, { Component, PropTypes } from 'react'; import React, { Component, PropTypes } from 'react';
import { FormattedMessage as Message } from 'react-intl'; import { FormattedMessage as Message } from 'react-intl';
import { Link } from 'react-router';
import classNames from 'classnames'; import classNames from 'classnames';
import Helmet from 'react-helmet'; import Helmet from 'react-helmet';
import { Motion, spring } from 'react-motion'; import { Motion, spring } from 'react-motion';

View File

@ -69,8 +69,11 @@ export default connect(null, {
return Promise.resolve({requirePassword}); return Promise.resolve({requirePassword});
} }
}) })
.then((resp) => new Promise((resolve) => { .then((resp) => !resp.requirePassword || requestPassword(form))
if (resp.requirePassword) { .finally(() => form.endLoading());
function requestPassword(form) {
return new Promise((resolve) => {
dispatch(createPopup(PasswordRequestForm, (props) => ({ dispatch(createPopup(PasswordRequestForm, (props) => ({
form, form,
onSubmit: () => { onSubmit: () => {
@ -88,10 +91,7 @@ export default connect(null, {
.finally(() => form.endLoading()); .finally(() => form.endLoading());
} }
}))); })));
} else { });
resolve();
} }
}))
.finally(() => form.endLoading());
} }
})(ProfilePage); })(ProfilePage);