Last active
December 28, 2020 08:37
-
-
Save samteb/1d62cce38c5379bc03f9ae23914fb765 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { Observable } from 'rxjs'; | |
import { ApiService } from '../api.service'; | |
import { StoreService } from '../store.service'; | |
import { PaginationModel } from '../../models/pagination.model'; | |
import { ListLevel } from '../../models/list-level.enum'; | |
import { AuthorModel } from '../../models/author.model'; | |
import { ArticleModel } from '../../models/article.model'; | |
export type ListType = AuthorModel[] | ArticleModel[]; | |
@Injectable() | |
export abstract class ListService { | |
public listLevel$: Observable<ListLevel>; | |
public nbArticles$: Observable<number>; | |
public pagination$: Observable<PaginationModel>; | |
public topic$: Observable<string>; | |
abstract listTitle: string; | |
abstract showNbOfArticlesDropdown: boolean; | |
constructor( | |
protected apiService: ApiService, | |
protected storeService: StoreService | |
) { | |
this.listLevel$ = this.storeService.select('listLevel'); | |
this.nbArticles$ = this.storeService.select('nbOfArticles'); | |
this.pagination$ = this.storeService.select('pagination'); | |
this.topic$ = this.storeService.select('topic'); | |
} | |
abstract getList(): Observable<ListType>; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment