summaryrefslogtreecommitdiff
path: root/frontend/views/page/components/tile.edit.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-06-02 22:34:16 +0200
committerJules Laplace <julescarbon@gmail.com>2020-06-02 22:34:16 +0200
commitabd277bc02d36570038de4c0646a672f5585fa84 (patch)
tree91a8955ce1838892dc55389c920370a06ac04a91 /frontend/views/page/components/tile.edit.js
parent70a29089cdb05df27cf50b50fcbc2e53d8975571 (diff)
stubbing in page editor
Diffstat (limited to 'frontend/views/page/components/tile.edit.js')
-rw-r--r--frontend/views/page/components/tile.edit.js55
1 files changed, 55 insertions, 0 deletions
diff --git a/frontend/views/page/components/tile.edit.js b/frontend/views/page/components/tile.edit.js
new file mode 100644
index 0000000..3420505
--- /dev/null
+++ b/frontend/views/page/components/tile.edit.js
@@ -0,0 +1,55 @@
+import React, { Component } from 'react'
+import { Link } from 'react-router-dom'
+import { connect } from 'react-redux'
+
+import { history } from '../../../store'
+import actions from '../../../actions'
+
+import { Loader } from '../../../common'
+
+import TileForm from '../components/tile.form'
+
+class TileEdit extends Component {
+ componentDidMount() {
+ console.log(this.props.match.params.id)
+ actions.tile.show(this.props.match.params.id)
+ }
+
+ handleSubmit(data) {
+ actions.tile.update(data)
+ .then(response => {
+ // response
+ console.log(response)
+ })
+ }
+
+ render() {
+ const { show } = this.props.tile
+ if (show.loading || !show.res) {
+ return (
+ <div className='form'>
+ <Loader />
+ </div>
+ )
+ }
+ return (
+ <TileForm
+ data={show.res}
+ graph={this.props.graph.show.res}
+ onSubmit={this.handleSubmit.bind(this)}
+ />
+ )
+ }
+}
+
+const mapStateToProps = state => ({
+ graph: state.graph,
+ page: state.page,
+ tile: state.tile,
+})
+
+const mapDispatchToProps = dispatch => ({
+ // searchActions: bindActionCreators({ ...searchActions }, dispatch),
+})
+
+export default connect(mapStateToProps, mapDispatchToProps)(TileEdit)