Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Commit

Permalink
feat(spaces): Support infinite scroll for spaces
Browse files Browse the repository at this point in the history
Added methds to allow the infinite scroll component of ngx-widgets
to be used to display spaces.
  • Loading branch information
VineetReynolds authored and joshuawilson committed Mar 27, 2017
1 parent 39990f7 commit f447d9f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/app/spaces/space.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,20 @@ export class SpaceService {
}

// Currently serves to fetch the list of all spaces owned by a user.
getSpacesByUser(userName: string): Observable<Space[]> {
let url = `${this.namedSpacesUrl}/${userName}`;
getSpacesByUser(userName: string, pageSize: number = 20): Observable<Space[]> {
let url = `${this.namedSpacesUrl}/${userName}` + '?page[limit]=' + pageSize;
let isAll = false;
return this.getSpacesDelegate(url, isAll);
}

getMoreSpacesByUser(): Observable<Space[]> {
if (this.nextLink) {
return this.getSpacesDelegate(this.nextLink, false);
} else {
return Observable.throw('No more spaces found');
}
}

getSpaceById(spaceId: string): Observable<Space> {
let url = `${this.spacesUrl}/${spaceId}`;
return this.http.get(url, { headers: this.headers })
Expand Down

0 comments on commit f447d9f

Please sign in to comment.