Skip to content

Instantly share code, notes, and snippets.

@samteb
Created December 28, 2020 08:13
Show Gist options
  • Save samteb/1ba9a93afaa434bdcb8a76274cc0ba9d to your computer and use it in GitHub Desktop.
Save samteb/1ba9a93afaa434bdcb8a76274cc0ba9d to your computer and use it in GitHub Desktop.
import { Injectable } from '@angular/core';
import { combineLatest, Observable } from 'rxjs';
import { switchMap } from 'rxjs/operators';
import { AuthorModel } from '../../models/author.model';
import { ListService } from './list.service';
@Injectable()
export class AuthorsListService extends ListService {
public listTitle = 'Weekly best authors!';
public showNbOfArticlesDropdown = true;
public getList(): Observable<AuthorModel[]> {
return combineLatest([this.pagination$, this.topic$, this.listLevel$]).pipe(
switchMap(([{ first, last }, topic]) => {
return this.nbArticles$.pipe(
switchMap((nbArticles) => {
return this.apiService.fetchAuthors({
first,
last,
topic,
nbArticles,
});
})
);
})
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment