mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 04:49:33 -07:00
Fixed the issue where we couldn't switch between filters on the discover page
This commit is contained in:
parent
85068d81b4
commit
f50536c005
1 changed files with 29 additions and 24 deletions
|
@ -135,26 +135,10 @@ export class CarouselListComponent implements OnInit {
|
||||||
this.discoverOptions = DiscoverOption[DiscoverOption[localDiscoverOptions]];
|
this.discoverOptions = DiscoverOption[DiscoverOption[localDiscoverOptions]];
|
||||||
}
|
}
|
||||||
|
|
||||||
while(this.discoverResults.length < 14) {
|
let currentIteration = 0;
|
||||||
var moviePromise: Promise<void>;
|
while (this.discoverResults.length <= 14 && currentIteration <= 3) {
|
||||||
var tvPromise: Promise<void>;
|
currentIteration++;
|
||||||
switch (this.discoverOptions) {
|
await this.loadData();
|
||||||
case DiscoverOption.Combined:
|
|
||||||
moviePromise = this.loadMovies();
|
|
||||||
tvPromise = this.loadTv();
|
|
||||||
break;
|
|
||||||
case DiscoverOption.Movie:
|
|
||||||
moviePromise = this.loadMovies();
|
|
||||||
break;
|
|
||||||
case DiscoverOption.Tv:
|
|
||||||
tvPromise = this.loadTv();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
await moviePromise;
|
|
||||||
await tvPromise;
|
|
||||||
|
|
||||||
this.createInitialModel();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +153,7 @@ export class CarouselListComponent implements OnInit {
|
||||||
if (end) {
|
if (end) {
|
||||||
var moviePromise: Promise<void>;
|
var moviePromise: Promise<void>;
|
||||||
var tvPromise: Promise<void>;
|
var tvPromise: Promise<void>;
|
||||||
switch (this.discoverOptions) {
|
switch (+this.discoverOptions) {
|
||||||
case DiscoverOption.Combined:
|
case DiscoverOption.Combined:
|
||||||
moviePromise = this.loadMovies();
|
moviePromise = this.loadMovies();
|
||||||
tvPromise = this.loadTv();
|
tvPromise = this.loadTv();
|
||||||
|
@ -188,14 +172,35 @@ export class CarouselListComponent implements OnInit {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async loadData() {
|
||||||
|
var moviePromise: Promise<void>;
|
||||||
|
var tvPromise: Promise<void>;
|
||||||
|
switch (+this.discoverOptions) {
|
||||||
|
case DiscoverOption.Combined:
|
||||||
|
moviePromise = this.loadMovies();
|
||||||
|
tvPromise = this.loadTv();
|
||||||
|
break;
|
||||||
|
case DiscoverOption.Movie:
|
||||||
|
moviePromise = this.loadMovies();
|
||||||
|
break;
|
||||||
|
case DiscoverOption.Tv:
|
||||||
|
tvPromise = this.loadTv();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
await moviePromise;
|
||||||
|
await tvPromise;
|
||||||
|
this.createInitialModel();
|
||||||
|
}
|
||||||
|
|
||||||
private async switchDiscoverMode(newMode: DiscoverOption) {
|
private async switchDiscoverMode(newMode: DiscoverOption) {
|
||||||
if (this.discoverOptions === newMode) {
|
if (this.discoverOptions === newMode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.loading();
|
this.loading();
|
||||||
this.discoverOptions = newMode;
|
this.currentlyLoaded = 0;
|
||||||
|
this.discoverOptions = +newMode;
|
||||||
this.storageService.save(this.mediaTypeStorageKey, newMode.toString());
|
this.storageService.save(this.mediaTypeStorageKey, newMode.toString());
|
||||||
await this.ngOnInit();
|
await this.loadData();
|
||||||
this.finishLoading();
|
this.finishLoading();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,7 +242,7 @@ export class CarouselListComponent implements OnInit {
|
||||||
private createModel() {
|
private createModel() {
|
||||||
const tempResults = <IDiscoverCardResult[]>[];
|
const tempResults = <IDiscoverCardResult[]>[];
|
||||||
|
|
||||||
switch (this.discoverOptions) {
|
switch (+this.discoverOptions) {
|
||||||
case DiscoverOption.Combined:
|
case DiscoverOption.Combined:
|
||||||
tempResults.push(...this.mapMovieModel());
|
tempResults.push(...this.mapMovieModel());
|
||||||
tempResults.push(...this.mapTvModel());
|
tempResults.push(...this.mapTvModel());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue