diff --git a/libs/angular/src/components/send/add-edit.component.ts b/libs/angular/src/components/send/add-edit.component.ts index 51c8f12048..55b8a03b83 100644 --- a/libs/angular/src/components/send/add-edit.component.ts +++ b/libs/angular/src/components/send/add-edit.component.ts @@ -201,25 +201,14 @@ export class AddEditComponent implements OnInit, OnDestroy { } this.onSavedSend.emit(this.send); if (this.copyLink && this.link != null) { - const copySuccess = await this.copyLinkToClipboard(this.link); - if (copySuccess ?? true) { - this.platformUtilsService.showToast( - "success", - null, - this.i18nService.t(this.editMode ? "editedSend" : "createdSend") - ); - } else { - await this.platformUtilsService.showDialog( - this.i18nService.t(this.editMode ? "editedSend" : "createdSend"), - null, - this.i18nService.t("ok"), - null, - "success", - null - ); - await this.copyLinkToClipboard(this.link); - } + await this.handleCopyLinkToClipboard(); + return; } + this.platformUtilsService.showToast( + "success", + null, + this.i18nService.t(this.editMode ? "editedSend" : "createdSend") + ); }); try { await this.formPromise; @@ -308,4 +297,24 @@ export class AddEditComponent implements OnInit, OnDestroy { this.showPassword = !this.showPassword; document.getElementById("password").focus(); } + private async handleCopyLinkToClipboard() { + const copySuccess = await this.copyLinkToClipboard(this.link); + if (copySuccess ?? true) { + this.platformUtilsService.showToast( + "success", + null, + this.i18nService.t(this.editMode ? "editedSend" : "createdSend") + ); + } else { + await this.platformUtilsService.showDialog( + this.i18nService.t(this.editMode ? "editedSend" : "createdSend"), + null, + this.i18nService.t("ok"), + null, + "success", + null + ); + await this.copyLinkToClipboard(this.link); + } + } }