Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Commit

Permalink
Include encrypt in formPromise (#368)
Browse files Browse the repository at this point in the history
* Include encrypt in formPromise

(cherry picked from commit e2cb9b6)
  • Loading branch information
Hinton committed May 5, 2021
1 parent 96e6dc8 commit ab333db
Showing 1 changed file with 24 additions and 21 deletions.
45 changes: 24 additions & 21 deletions src/angular/components/send/add-edit.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,27 +298,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 { }

return false;
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 await this.formPromise;
}

async showSuccessMessage(inactive: boolean) {
Expand Down

0 comments on commit ab333db

Please sign in to comment.