mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-11-14 20:25:56 +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 messages from './footerMenu.intl.json';
|
||||
|
||||
export default class FooterMenu extends Component {
|
||||
class FooterMenu extends Component {
|
||||
static displayName = 'FooterMenu';
|
||||
|
||||
static propTypes = {
|
||||
|
@ -1,7 +1,6 @@
|
||||
import React, { Component, PropTypes } from 'react';
|
||||
|
||||
import { FormattedMessage as Message } from 'react-intl';
|
||||
import { Link } from 'react-router';
|
||||
import classNames from 'classnames';
|
||||
import Helmet from 'react-helmet';
|
||||
import { Motion, spring } from 'react-motion';
|
||||
|
@ -69,29 +69,29 @@ export default connect(null, {
|
||||
return Promise.resolve({requirePassword});
|
||||
}
|
||||
})
|
||||
.then((resp) => new Promise((resolve) => {
|
||||
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();
|
||||
}
|
||||
}))
|
||||
.then((resp) => !resp.requirePassword || requestPassword(form))
|
||||
.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);
|
||||
|
Loading…
Reference in New Issue
Block a user