optimize read calls
This commit is contained in:
@@ -3,7 +3,7 @@ import {Injectable} from '@angular/core';
|
||||
import {Observable} from 'rxjs';
|
||||
import {SongService} from './song.service';
|
||||
import {Song} from './song';
|
||||
import {filter} from 'rxjs/operators';
|
||||
import {take} from 'rxjs/operators';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
@@ -12,6 +12,6 @@ export class SongListResolver {
|
||||
public constructor(private songService: SongService) {}
|
||||
|
||||
public resolve(): Observable<Song[]> {
|
||||
return this.songService.list$().pipe(filter(_ => _.length > 0));
|
||||
return this.songService.list$().pipe(take(1));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user