Reorganize JSON to immutable conversion

This commit is contained in:
lukasmartinelli
2016-09-10 21:29:18 +02:00
parent ac3844f35c
commit 575dacdb2c
5 changed files with 86 additions and 56 deletions

View File

@@ -39,10 +39,10 @@ export default class App extends React.Component {
}
onStyleDownload() {
const mapStyle = JSON.stringify(this.state.currentStyle.toJS(), null, 4)
const mapStyle = JSON.stringify(this.state.currentStyle.toJSON(), null, 4)
const blob = new Blob([mapStyle], {type: "application/json;charset=utf-8"});
saveAs(blob, mapStyle.id + ".json");
this.onStyleSave(mapStyle)
this.onStyleSave()
}
onStyleUpload(newStyle) {
@@ -52,8 +52,7 @@ export default class App extends React.Component {
onStyleSave() {
const snapshotStyle = this.state.currentStyle.set('modified', new Date().toJSON())
const savedStyle = this.styleStore.save(snapshotStyle)
this.setState({ currentStyle: savedStyle })
this.setState({ currentStyle: snapshotStyle })
}
onStyleChanged(newStyle) {