mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-20 00:08:02 +01:00
only optimistic update if success
This commit is contained in:
parent
b2d4cbf5de
commit
c6118baad3
@ -64,6 +64,7 @@ var Unleash = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
createFeature: function (feature) {
|
createFeature: function (feature) {
|
||||||
|
var created = function() {
|
||||||
var unsaved = [], state = this.state;
|
var unsaved = [], state = this.state;
|
||||||
|
|
||||||
this.state.unsavedFeatures.forEach(function(f) {
|
this.state.unsavedFeatures.forEach(function(f) {
|
||||||
@ -76,9 +77,11 @@ var Unleash = React.createClass({
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.setState({unsavedFeatures: unsaved});
|
this.setState({unsavedFeatures: unsaved});
|
||||||
|
}.bind(this);
|
||||||
|
|
||||||
|
|
||||||
this.state.featureStore.createFeature(feature)
|
this.state.featureStore.createFeature(feature)
|
||||||
.then(function(r) { console.log(r.statusText); }.bind(this))
|
.then(created)
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user