mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-01-16 08:33:15 +05:30
small refactoring
This commit is contained in:
parent
0816e7a848
commit
232cf0465c
@ -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 = {
|
||||||
|
@ -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';
|
||||||
|
@ -69,29 +69,29 @@ 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) {
|
|
||||||
dispatch(createPopup(PasswordRequestForm, (props) => ({
|
|
||||||
form,
|
|
||||||
onSubmit: () => {
|
|
||||||
form.beginLoading();
|
|
||||||
sendData()
|
|
||||||
.catch((resp) => {
|
|
||||||
if (resp.errors) {
|
|
||||||
form.setErrors(resp.errors);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Promise.reject(resp);
|
|
||||||
})
|
|
||||||
.then(resolve)
|
|
||||||
.then(props.onClose)
|
|
||||||
.finally(() => form.endLoading());
|
|
||||||
}
|
|
||||||
})));
|
|
||||||
} else {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
.finally(() => form.endLoading());
|
.finally(() => form.endLoading());
|
||||||
|
|
||||||
|
function requestPassword(form) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
dispatch(createPopup(PasswordRequestForm, (props) => ({
|
||||||
|
form,
|
||||||
|
onSubmit: () => {
|
||||||
|
form.beginLoading();
|
||||||
|
sendData()
|
||||||
|
.catch((resp) => {
|
||||||
|
if (resp.errors) {
|
||||||
|
form.setErrors(resp.errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Promise.reject(resp);
|
||||||
|
})
|
||||||
|
.then(resolve)
|
||||||
|
.then(props.onClose)
|
||||||
|
.finally(() => form.endLoading());
|
||||||
|
}
|
||||||
|
})));
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})(ProfilePage);
|
})(ProfilePage);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user