1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-10-17 07:15:13 +02:00

Initialize RegistrationSelfHostedEnvConfigDialog with existing values if self hosted

This commit is contained in:
Alec Rippberger 2024-10-16 21:20:27 -05:00
parent c13bded29b
commit d4437ea7dd
No known key found for this signature in database
GPG Key ID: 9DD8DA583B28154A

View File

@ -10,7 +10,7 @@ import {
ValidationErrors, ValidationErrors,
ValidatorFn, ValidatorFn,
} from "@angular/forms"; } from "@angular/forms";
import { Subject, firstValueFrom } from "rxjs"; import { Subject, firstValueFrom, take, filter, takeUntil } from "rxjs";
import { JslibModule } from "@bitwarden/angular/jslib.module"; import { JslibModule } from "@bitwarden/angular/jslib.module";
import { import {
@ -131,7 +131,24 @@ export class RegistrationSelfHostedEnvConfigDialogComponent implements OnInit, O
private environmentService: EnvironmentService, private environmentService: EnvironmentService,
) {} ) {}
ngOnInit() {} ngOnInit() {
this.environmentService.environment$
.pipe(
take(1),
filter((env) => env.getRegion() === Region.SelfHosted),
takeUntil(this.destroy$),
)
.subscribe((env) => {
const urls = env.getUrls();
this.formGroup.patchValue({
webVaultUrl: urls.webVault || "",
apiUrl: urls.api || "",
identityUrl: urls.identity || "",
iconsUrl: urls.icons || "",
notificationsUrl: urls.notifications || "",
});
});
}
submit = async () => { submit = async () => {
this.showErrorSummary = false; this.showErrorSummary = false;