fix: Fixed the load error

This commit is contained in:
tidusjar 2022-11-23 21:17:35 +00:00
commit c59a77a9d3
2 changed files with 6 additions and 1 deletions

View file

@ -13,6 +13,7 @@ import { StatusService } from "../services";
import { StorageService } from "../shared/storage/storage-service";
import { MatSnackBar } from "@angular/material/snack-bar";
import { CustomizationFacade } from "../state/customization";
import { SonarrFacade } from "app/state/sonarr";
@Component({
templateUrl: "./login.component.html",
@ -60,6 +61,7 @@ export class LoginComponent implements OnDestroy, OnInit {
private translate: TranslateService,
private plexTv: PlexTvService,
private store: StorageService,
private sonarrFacade: SonarrFacade,
private readonly notify: MatSnackBar
) {
this.href = href;
@ -142,6 +144,7 @@ export class LoginComponent implements OnDestroy, OnInit {
if (this.authService.loggedIn()) {
this.ngOnDestroy();
this.sonarrFacade.load().subscribe();
this.router.navigate(["/"]);
} else {
this.notify.open(this.errorBody, "OK", {
@ -218,6 +221,7 @@ export class LoginComponent implements OnDestroy, OnInit {
this.oAuthWindow.close();
}
this.oauthLoading = false;
this.sonarrFacade.load().subscribe();
this.router.navigate(["search"]);
return;
}
@ -248,6 +252,7 @@ export class LoginComponent implements OnDestroy, OnInit {
if (this.authService.loggedIn()) {
this.ngOnDestroy();
this.sonarrFacade.load().subscribe();
this.router.navigate(["/"]);
} else {
this.notify.open(this.errorBody, "OK", {

View file

@ -19,7 +19,7 @@ export class SonarrSettingsState {
@Action(LoadSettings)
public load({ setState }: StateContext<SonarrState>): Observable<SonarrState> {
const isAdmin = this.authService.isAdmin();
const calls = isAdmin ? [this.sonarrService.getVersion(), this.settingsService.getSonarr()] : [this.sonarrService.getVersion(), of({})];
const calls = isAdmin ? [this.sonarrService.getVersion(), this.settingsService.getSonarr()] : [of(""), of({})];
return combineLatest(calls).pipe(
tap(([version, settings]) =>