Skip to content

Commit dd55c06

Browse files
authored
feat(Query for Author): If passed Author id query Author API (#78)
* Accomodate url structure for authors * Make the change to accomodate only authors for now
1 parent 611c2f9 commit dd55c06

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/components/load-more-stories-base.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,13 @@ export class LoadMoreStoriesBase extends React.Component {
7474
export class LoadMoreCollectionStories extends React.Component {
7575
loadMoreStories(pageNumber) {
7676
const stories = get(this.props, ['data', 'stories'], []);
77-
return getRequest(`/api/v1/collections/${this.props.collectionSlug}`, Object.assign({}, this.props.params, {
77+
const authorId = get(this.props, ["authorId"],null);
78+
79+
const url = authorId ?
80+
`/api/v1/authors/${authorId}/collection`:
81+
`/api/v1/collections/${this.props.collectionSlug}`;
82+
83+
return getRequest(url, Object.assign({}, this.props.params, {
7884
offset: this.props.numStoriesToLoad * (pageNumber - 1) + stories.length,
7985
limit: this.props.numStoriesToLoad || 10,
8086
})).json(response => (response.items || []).map(item => item.story));

0 commit comments

Comments
 (0)