mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-23 14:35: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 { IDiscoverCardResult } from "../../interfaces";
|
||||||
import { RequestType } from "../../../interfaces";
|
import { RequestType } from "../../../interfaces";
|
||||||
import { AuthService } from "../../../auth/auth.service";
|
import { AuthService } from "../../../auth/auth.service";
|
||||||
import { FilterService } from "../../services/filter-service";
|
|
||||||
import { SearchFilter } from "../../../my-nav/SearchFilter";
|
|
||||||
import { forkJoin } from "rxjs";
|
import { forkJoin } from "rxjs";
|
||||||
import { isEqual } from "lodash";
|
import { isEqual } from "lodash";
|
||||||
|
|
||||||
|
@ -20,14 +18,10 @@ export class DiscoverActorComponent {
|
||||||
public isAdmin: boolean;
|
public isAdmin: boolean;
|
||||||
|
|
||||||
public discoverResults: IDiscoverCardResult[] = [];
|
public discoverResults: IDiscoverCardResult[] = [];
|
||||||
public filter: SearchFilter;
|
|
||||||
|
|
||||||
constructor(private searchService: SearchV2Service,
|
constructor(private searchService: SearchV2Service,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private filterService: FilterService,
|
|
||||||
private auth: AuthService) {
|
private auth: AuthService) {
|
||||||
|
|
||||||
this.filter = this.filterService.filter;
|
|
||||||
this.route.params.subscribe((params: any) => {
|
this.route.params.subscribe((params: any) => {
|
||||||
this.actorId = params.actorId;
|
this.actorId = params.actorId;
|
||||||
this.isAdmin = this.auth.isAdmin();
|
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() {
|
private search() {
|
||||||
this.discoverResults = [];
|
this.discoverResults = [];
|
||||||
this.loading();
|
this.loading();
|
||||||
|
|
||||||
var searches = [];
|
var searches = [];
|
||||||
if (this.filter.movies) {
|
|
||||||
var moviesSearch = this.searchService.getMoviesByActor(this.actorId);
|
var moviesSearch = this.searchService.getMoviesByActor(this.actorId);
|
||||||
moviesSearch.subscribe(res => {
|
moviesSearch.subscribe(res => {
|
||||||
this.pushDiscoverResults(res.cast, RequestType.movie);
|
this.pushDiscoverResults(res.cast, RequestType.movie);
|
||||||
});
|
});
|
||||||
searches.push(moviesSearch);
|
searches.push(moviesSearch);
|
||||||
}
|
|
||||||
|
|
||||||
if (this.filter.tvShows) {
|
|
||||||
var TvSearch = this.searchService.getTvByActor(this.actorId);
|
var TvSearch = this.searchService.getTvByActor(this.actorId);
|
||||||
TvSearch.subscribe(res => {
|
TvSearch.subscribe(res => {
|
||||||
this.pushDiscoverResults(res.cast, RequestType.tvShow);
|
this.pushDiscoverResults(res.cast, RequestType.tvShow);
|
||||||
});
|
});
|
||||||
searches.push(TvSearch);
|
searches.push(TvSearch);
|
||||||
}
|
|
||||||
|
|
||||||
if (searches.length === 0) {
|
|
||||||
this.finishLoading();
|
|
||||||
}
|
|
||||||
forkJoin(searches).subscribe(() => {
|
forkJoin(searches).subscribe(() => {
|
||||||
this.finishLoading();
|
this.finishLoading();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue