Skip to content

Commit

Permalink
Merge remote-tracking branch 'atomic-client/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
jbasdf committed Jan 9, 2017
2 parents 9e58559 + 142310c commit e28dd5c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions client/js/libs/canvas/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,25 @@ function proxyCanvas(store, action, params) {
},
action.body
).then((response, error) => {
let lastPage = false;

if (action.canvas.method === 'get' && response.header) {
const nextUrl = getNextUrl(response.headers.link);
if (nextUrl) {
const newParams = parseParams(nextUrl);
if (newParams) {
proxyCanvas(store, action, newParams);
}
} else {
lastPage = true;
}
}

store.dispatch({
type: action.canvas.type + DONE,
payload: response.body,
original: action,
lastPage,
response,
error
}); // Dispatch the new data
Expand Down
2 changes: 2 additions & 0 deletions client/js/libs/urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export function getNextUrl(link){
});
if(url){
return url.split(';')[0].replace(/[\<\>\s]/g, "");
} else {
return null;
}
}
}
Expand Down

0 comments on commit e28dd5c

Please sign in to comment.