mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-23 06:25:24 -07:00
Remove user filter from discover actor page
This commit is contained in:
parent
07cde058ed
commit
7362446832
1 changed files with 10 additions and 32 deletions
|
@ -5,8 +5,6 @@ import { IActorCredits, IActorCast } from "../../../interfaces/ISearchTvResultV2
|
|||
import { IDiscoverCardResult } from "../../interfaces";
|
||||
import { RequestType } from "../../../interfaces";
|
||||
import { AuthService } from "../../../auth/auth.service";
|
||||
import { FilterService } from "../../services/filter-service";
|
||||
import { SearchFilter } from "../../../my-nav/SearchFilter";
|
||||
import { forkJoin } from "rxjs";
|
||||
import { isEqual } from "lodash";
|
||||
|
||||
|
@ -20,14 +18,10 @@ export class DiscoverActorComponent {
|
|||
public isAdmin: boolean;
|
||||
|
||||
public discoverResults: IDiscoverCardResult[] = [];
|
||||
public filter: SearchFilter;
|
||||
|
||||
constructor(private searchService: SearchV2Service,
|
||||
private route: ActivatedRoute,
|
||||
private filterService: FilterService,
|
||||
private auth: AuthService) {
|
||||
|
||||
this.filter = this.filterService.filter;
|
||||
this.route.params.subscribe((params: any) => {
|
||||
this.actorId = params.actorId;
|
||||
this.isAdmin = this.auth.isAdmin();
|
||||
|
@ -35,39 +29,23 @@ export class DiscoverActorComponent {
|
|||
});
|
||||
}
|
||||
|
||||
public async ngOnInit() {
|
||||
this.filterService.onFilterChange.subscribe(async x => {
|
||||
if (!isEqual(this.filter, x)) {
|
||||
this.filter = { ...x };
|
||||
await this.search();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private search() {
|
||||
this.discoverResults = [];
|
||||
this.loading();
|
||||
|
||||
var searches = [];
|
||||
if (this.filter.movies) {
|
||||
var moviesSearch = this.searchService.getMoviesByActor(this.actorId);
|
||||
moviesSearch.subscribe(res => {
|
||||
this.pushDiscoverResults(res.cast, RequestType.movie);
|
||||
});
|
||||
searches.push(moviesSearch);
|
||||
}
|
||||
var moviesSearch = this.searchService.getMoviesByActor(this.actorId);
|
||||
moviesSearch.subscribe(res => {
|
||||
this.pushDiscoverResults(res.cast, RequestType.movie);
|
||||
});
|
||||
searches.push(moviesSearch);
|
||||
|
||||
if (this.filter.tvShows) {
|
||||
var TvSearch = this.searchService.getTvByActor(this.actorId);
|
||||
TvSearch.subscribe(res => {
|
||||
this.pushDiscoverResults(res.cast, RequestType.tvShow);
|
||||
});
|
||||
searches.push(TvSearch);
|
||||
}
|
||||
var TvSearch = this.searchService.getTvByActor(this.actorId);
|
||||
TvSearch.subscribe(res => {
|
||||
this.pushDiscoverResults(res.cast, RequestType.tvShow);
|
||||
});
|
||||
searches.push(TvSearch);
|
||||
|
||||
if (searches.length === 0) {
|
||||
this.finishLoading();
|
||||
}
|
||||
forkJoin(searches).subscribe(() => {
|
||||
this.finishLoading();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue