1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 15:53:27 +00:00

Include encrypt in formPromise (#368)

* Include encrypt in formPromise
This commit is contained in:
Oscar Hinton
2021-05-04 16:26:26 +02:00
committed by GitHub
parent a72c8a60c1
commit e2cb9b6bef

View File

@@ -299,27 +299,30 @@ export class AddEditComponent implements OnInit {
this.password = null;
}
const encSend = await this.encryptSend(file);
try {
this.formPromise = this.sendService.saveWithServer(encSend);
let inactive = false;
setTimeout(() => inactive = true, 4500);
await this.formPromise;
if (this.send.id == null) {
this.send.id = encSend[0].id;
}
if (this.send.accessId == null) {
this.send.accessId = encSend[0].accessId;
}
this.onSavedSend.emit(this.send);
await this.showSuccessMessage(inactive);
if (this.copyLink) {
this.copyLinkToClipboard(this.link);
}
return true;
} catch { }
this.formPromise = this.encryptSend(file)
.then(async encSend => {
try {
const uploadPromise = this.sendService.saveWithServer(encSend);
let inactive = false;
setTimeout(() => inactive = true, 4500);
await uploadPromise;
if (this.send.id == null) {
this.send.id = encSend[0].id;
}
if (this.send.accessId == null) {
this.send.accessId = encSend[0].accessId;
}
this.onSavedSend.emit(this.send);
await this.showSuccessMessage(inactive);
if (this.copyLink) {
this.copyLinkToClipboard(this.link);
}
return true;
} catch { }
return false;
});
return false;
return await this.formPromise;
}
async showSuccessMessage(inactive: boolean) {