How can I write this with mobx and axios? I am trying to use the arrow function to keep the scope of "this" but I might be doing it wrong.
@action saveMode() {
axios.post('/Course/Post', { Name: "test41515"})
.then(response => {
console.log(response, this.isEditing);
this.isEditing = !this.isEditing;
this.failedValidation = [];
})
}
Uncaught (in promise) Error: [mobx] Invariant failed: Since strict-mode is enabled, changing observed observable values outside actions is not allowed. Please wrap the code in an `action` if this change is intended. Tried to modify: Course@5.isEditing
at invariant (app.bundle.js:7316)
at fail (app.bundle.js:7311)
at checkIfStateModificationsAreAllowed (app.bundle.js:7880)
at ObservableValue.prepareNewValue (app.bundle.js:5786)
at setPropertyValue (app.bundle.js:6663)
at Course.set [as isEditing] (app.bundle.js:6631)
at app.bundle.js:62336
at <anonymous>