import React, { Component, PropTypes } from 'react';
import classNames from 'classnames';
import { FormattedMessage as Message } from 'react-intl';
import { Input, TextArea, Button, Form, FormModel, Dropdown } from 'components/ui/form';
import feedback from 'services/api/feedback';
import icons from 'components/ui/icons.scss';
import popupStyles from 'components/ui/popup/popup.scss';
import styles from './contactForm.scss';
import messages from './contactForm.intl.json';
const CONTACT_CATEGORIES = [
// TODO: сюда позже проставить реальные id категорий с backend
,
,
,
,
];
class ContactForm extends Component {
static displayName = 'ContactForm';
static propTypes = {
onClose: PropTypes.func.isRequired,
user: PropTypes.shape({
email: PropTypes.string
}).isRequired
};
form = new FormModel();
render() {
const {onClose, user} = this.props;
const {form} = this;
return (
);
}
onSubmit = () => {
feedback(this.form.serialize())
.then(this.props.onClose)
.catch((resp) => {
if (resp.errors) {
this.form.setErrors(resp.errors);
}
return Promise.reject(resp);
})
;
};
}
import { connect } from 'react-redux';
export default connect((state) => ({
user: state.user
}))(ContactForm);