Skip to content

Commit

Permalink
adds error condition to canvas middleware (#45)
Browse files Browse the repository at this point in the history
* adds error condition to canvas middleware

* un align stuff
  • Loading branch information
dittonjs committed Feb 28, 2017
1 parent 930f718 commit 05ec8dd
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions client/js/libs/canvas/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ function proxyCanvas(store, action, params) {
{
...action.params,
...params,
type : action.canvas.type,
oauth_consumer_key : state.settings.oauth_consumer_key
type: action.canvas.type,
oauth_consumer_key: state.settings.oauth_consumer_key
},
action.body
).then((response, error) => {
).then((response) => {
let lastPage = false;

if (action.canvas.method === 'get' && response.header) {
Expand All @@ -48,13 +48,18 @@ function proxyCanvas(store, action, params) {
}

store.dispatch({
type : action.canvas.type + DONE,
payload : response.body,
original : action,
type: action.canvas.type + DONE,
payload: response.body,
original: action,
lastPage,
response,
error
}); // Dispatch the new data
}).catch((error) => {
store.dispatch({
type: action.canvas.type + DONE,
original: action,
error,
});
});
}

Expand Down

0 comments on commit 05ec8dd

Please sign in to comment.