import React, { PropTypes } from 'react'; import { Button, Row, Col } from 'react-bootstrap'; import { connect } from 'redux'; import { createSelector } from 'reselect'; import PureComponent from 'react-pure-render/component'; import { goBack, push } from 'react-router-redux'; import ShowJob from './ShowJob.jsx'; import JobNotFound from './JobNotFound.jsx'; import { clearSavedForm, saveJobToDb } from '../redux/actions'; const mapStateToProps = createSelector( state => state.jobsApp.form, (job = {}) => ({ job }) ); const bindableActions = { goBack, push, clearSavedForm, saveJobToDb }; export class JobPreview extends PureComponent { static displayName = 'Preview'; static propTypes = { job: PropTypes.object }; componentDidMount() { const { push, job } = this.props; // redirect user in client if (!job || !job.position || !job.description) { push('/jobs/new'); } } render() { const { job, goBack, clearSavedForm, saveJobToDb } = this.props; if (!job || !job.position || !job.description) { return ; } return (

); } } export default connect(mapStateToProps, bindableActions)(JobPreview);