summaryrefslogtreecommitdiff
path: root/animism-align/frontend/app/views/project/containers/project.new.js
diff options
context:
space:
mode:
Diffstat (limited to 'animism-align/frontend/app/views/project/containers/project.new.js')
-rw-r--r--animism-align/frontend/app/views/project/containers/project.new.js62
1 files changed, 62 insertions, 0 deletions
diff --git a/animism-align/frontend/app/views/project/containers/project.new.js b/animism-align/frontend/app/views/project/containers/project.new.js
new file mode 100644
index 0000000..c8a2152
--- /dev/null
+++ b/animism-align/frontend/app/views/project/containers/project.new.js
@@ -0,0 +1,62 @@
+import React, { Component } from 'react'
+import { Link } from 'react-router-dom'
+import { connect } from 'react-redux'
+
+import { history } from 'app/store'
+import actions from 'app/actions'
+
+import ProjectForm from '../components/project.form'
+import ProjectMenu from '../components/project.menu'
+
+class ProjectNew extends Component {
+ state = {
+ loading: true,
+ initialData: {},
+ }
+
+ componentDidMount() {
+ this.setState({ loading: false })
+ }
+
+ handleSubmit(data) {
+ console.log(data)
+ actions.project.create(data)
+ .then(res => {
+ console.log(res)
+ if (res.res && res.res.id) {
+ history.push('/project/')
+ }
+ })
+ .catch(err => {
+ console.error('error')
+ })
+ }
+
+ render() {
+ if (this.state.loading) {
+ return (
+ <div className='row formContainer' />
+ )
+ }
+ return (
+ <div className='row formContainer'>
+ <ProjectMenu />
+ <ProjectForm
+ isNew
+ data={this.state.initialData}
+ onSubmit={this.handleSubmit.bind(this)}
+ />
+ </div>
+ )
+ }
+}
+
+const mapStateToProps = state => ({
+ project: state.project,
+})
+
+const mapDispatchToProps = dispatch => ({
+ // uploadActions: bindActionCreators({ ...uploadActions }, dispatch),
+})
+
+export default connect(mapStateToProps, mapDispatchToProps)(ProjectNew)