Skip to content

Commit

Permalink
Made promises return data
Browse files Browse the repository at this point in the history
  • Loading branch information
masylum committed Aug 21, 2016
1 parent 5eac139 commit ac36525
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mobx-rest",
"version": "0.0.8",
"version": "0.0.9",
"description": "REST conventions for mobx.",
"repository": {
"type": "git",
Expand Down
4 changes: 4 additions & 0 deletions src/Collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ class Collection {
} else {
this.add([data])
}

return data
})
.catch((body) => {
if (model) this.remove([model.id])
Expand All @@ -157,6 +159,8 @@ class Collection {
.then((data) => {
this.request = null
this.set(data, options)

return data
})
.catch((body) => {
this.request = null
Expand Down
2 changes: 2 additions & 0 deletions src/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ class Model {
.then((data) => {
this.request = null
this.set(data)

return data
})
.catch((body) => {
this.request = null
Expand Down

0 comments on commit ac36525

Please sign in to comment.