Skip to content

Commit

Permalink
fix(wizard): 🐛 Stop access to the wizard when you have already setup …
Browse files Browse the repository at this point in the history
…ombi (#4866)
  • Loading branch information
tidusjar committed Feb 10, 2023
1 parent c088054 commit 353de98
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/Ombi/.vscode/settings.json
Expand Up @@ -24,7 +24,8 @@
"details",
"requests",
"sonarr",
"plex"
"plex",
"wizard"
],
"rpc.enabled": true
}
2 changes: 2 additions & 0 deletions src/Ombi/ClientApp/src/app/login/login.component.ts
Expand Up @@ -90,6 +90,8 @@ export class LoginComponent implements OnDestroy, OnInit {

if (authService.loggedIn()) {
this.loadStores();

this.router.navigate(["/"]);
}
}

Expand Down
8 changes: 6 additions & 2 deletions src/Ombi/ClientApp/src/app/services/status.service.ts
Expand Up @@ -11,7 +11,11 @@ export class StatusService extends ServiceHelpers {
constructor(http: HttpClient, @Inject(APP_BASE_HREF) href:string) {
super(http, "/api/v1/status/", href);
}
public getWizardStatus(): Observable<any> {
return this.http.get(`${this.url}Wizard/`, {headers: this.headers});
public getWizardStatus(): Observable<WizardResult> {
return this.http.get<WizardResult>(`${this.url}Wizard/`, {headers: this.headers});
}
}

export interface WizardResult {
result: boolean;
}
12 changes: 10 additions & 2 deletions src/Ombi/ClientApp/src/app/wizard/welcome/welcome.component.ts
@@ -1,12 +1,13 @@
import { Component, OnInit, ViewChild } from "@angular/core";
import { IdentityService, NotificationService, SettingsService } from "../../services";
import { IdentityService, NotificationService, SettingsService, StatusService } from "../../services";

import { CustomizationFacade } from "../../state/customization/customization.facade";
import { ICreateWizardUser } from "../../interfaces";
import { IOmbiConfigModel } from "../models/OmbiConfigModel";
import { MatStepper } from'@angular/material/stepper';
import { Router } from "@angular/router";
import { WizardService } from "../services/wizard.service";
import { Observable, take } from "rxjs";

@Component({
templateUrl: "./welcome.component.html",
Expand All @@ -20,9 +21,16 @@ export class WelcomeComponent implements OnInit {

constructor(private router: Router, private identityService: IdentityService,
private notificationService: NotificationService, private WizardService: WizardService,
private settingsService: SettingsService, private customizationFacade: CustomizationFacade) { }
private settingsService: SettingsService, private customizationFacade: CustomizationFacade,
private status: StatusService) { }

public ngOnInit(): void {
this.status.getWizardStatus().pipe(take(1))
.subscribe(x => {
if (x.result) {
this.router.navigate(["login"]);
}
});
this.localUser = {
password:"",
username:"",
Expand Down

0 comments on commit 353de98

Please sign in to comment.