summaryrefslogtreecommitdiff
path: root/frontend/views/page/components/tile.edit.js
diff options
context:
space:
mode:
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)