summaryrefslogtreecommitdiff
path: root/frontend/views/page/components/tile.edit.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-06-06 22:30:45 +0200
committerJules Laplace <julescarbon@gmail.com>2020-06-06 22:30:45 +0200
commitd1fd3c4f62b0e05f79565fc72423ba0fed5474f1 (patch)
tree5ce037eb6f5c74d56eae7ed2fce65ccbd24e8a52 /frontend/views/page/components/tile.edit.js
parent810dbf4859b6c45f9a8446017cce462448fe1fe2 (diff)
sorting elements better... loading item on dblclick
Diffstat (limited to 'frontend/views/page/components/tile.edit.js')
-rw-r--r--frontend/views/page/components/tile.edit.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/frontend/views/page/components/tile.edit.js b/frontend/views/page/components/tile.edit.js
index cb339c9..2f6dad7 100644
--- a/frontend/views/page/components/tile.edit.js
+++ b/frontend/views/page/components/tile.edit.js
@@ -16,18 +16,27 @@ class TileEdit extends Component {
state = {
tile: null
}
+
componentDidMount() {
+ this.load()
+ }
+
+ componentDidUpdate(prevProps) {
+ if (prevProps.page.editor.currentEditTileId !== this.props.page.editor.currentEditTileId) {
+ this.load()
+ }
+ }
+
+ load() {
const { currentEditTileId } = this.props.page.editor
const tile = this.props.page.show.res.tiles.filter(tile => tile.id === currentEditTileId)[0]
console.log('edit', currentEditTileId)
this.setState({ tile })
- // actions.tile.show(this.props.match.params.id)
}
handleSubmit(data) {
actions.tile.update(data)
.then(response => {
- // response
// console.log(response)
if (response.status === 'ok') {
this.props.pageActions.updatePageTile(response.res)