fix(console): update Twilio sms provider settings (#6732)

fix: update sms provider settings

Co-authored-by: Elio Bischof <[email protected]>
This commit is contained in:
Miguel Cabrerizo
2023-10-24 12:55:39 +00:00
committed by GitHub
co-authored by Elio Bischof
parent b4fd566746
commit 36eeae1071
16 changed files with 68 additions and 7 deletions
@@ -18,7 +18,7 @@
<input cnslInput name="senderNumber" formControlName="senderNumber" />
</cnsl-form-field>
<button *ngIf="twilio" type="button" mat-stroked-button (click)="changeToken()">
<button *ngIf="twilio" type="button" mat-stroked-button (click)="changeToken()" data-e2e="edit-sms-token-button">
{{ 'SETTING.SMS.TWILIO.CHANGETOKEN' | translate }}
</button>
</form>
@@ -61,15 +61,14 @@ export class DialogAddSMSProviderComponent {
}
public closeDialogWithRequest(): void {
if (!!this.twilio) {
if (!!this.twilio && this.twilioProvider && this.twilioProvider.id) {
this.req = new UpdateSMSProviderTwilioRequest();
this.req.setId(this.twilioProvider.id);
this.req.setSid(this.sid?.value);
this.req.setSenderNumber(this.senderNumber?.value);
this.dialogRef.close(this.req);
} else {
this.req = new AddSMSProviderTwilioRequest();
this.req.setSid(this.sid?.value);
this.req.setToken(this.token?.value);
this.req.setSenderNumber(this.senderNumber?.value);
@@ -24,6 +24,7 @@
*ngIf="twilio && twilio.id"
[disabled]="(['iam.write'] | hasRole | async) === false"
mat-stroked-button
data-e2e="activate-sms-provider-button"
(click)="toggleSMSProviderState(twilio.id)"
>
<span *ngIf="twilio.state === SMSProviderConfigState.SMS_PROVIDER_CONFIG_ACTIVE">{{
@@ -33,6 +33,7 @@ export class NotificationSMSProviderComponent implements OnInit {
ngOnInit(): void {
this.fetchData();
}
private fetchData(): void {
this.smsProvidersLoading = true;
this.service
@@ -63,7 +64,7 @@ export class NotificationSMSProviderComponent implements OnInit {
this.service
.updateSMSProviderTwilio(req as UpdateSMSProviderTwilioRequest)
.then(() => {
this.toast.showInfo('SETTING.SMS.TWILIO.ADDED', true);
this.toast.showInfo('SETTING.SMS.TWILIO.UPDATED', true);
this.fetchData();
})
.catch((error) => {