Skip to content

Commit eac0bd6

Browse files
committed
fix: api configuration edition would sometimes not display correct status for save button
1 parent 8aef9bd commit eac0bd6

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

apps/back-office/src/app/dashboard/pages/api-configuration/api-configuration.component.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,8 @@ export class ApiConfigurationComponent
103103
this.apiConfiguration.name as string
104104
);
105105
this.apiForm = this.createApiForm(data.apiConfiguration);
106-
this.apiForm
107-
.get('authType')
108-
?.valueChanges.pipe(takeUntil(this.destroy$))
106+
this.apiForm.controls.authType?.valueChanges
107+
.pipe(takeUntil(this.destroy$))
109108
.subscribe((value) => {
110109
this.resetFormSettings(value);
111110
});
@@ -162,9 +161,9 @@ export class ApiConfigurationComponent
162161
* @param authType current auth type of the API configuration
163162
*/
164163
private resetFormSettings(authType: string) {
165-
this.apiForm.controls.settings.clearValidators();
166-
this.apiForm.controls.settings = this.buildSettingsForm(authType);
167-
this.apiForm.controls.settings.updateValueAndValidity();
164+
(this.apiForm as any).removeControl('settings', { emitEvent: false });
165+
this.apiForm.addControl('settings', this.buildSettingsForm(authType));
166+
this.apiForm.updateValueAndValidity();
168167
}
169168

170169
/**

0 commit comments

Comments
 (0)