diff --git a/src/app/send/send.component.ts b/src/app/send/send.component.ts index 25fdf141f1..2386c63556 100644 --- a/src/app/send/send.component.ts +++ b/src/app/send/send.component.ts @@ -37,7 +37,6 @@ export class SendComponent extends BaseSendComponent implements OnInit { sendId: string; modal: ModalComponent = null; action: Action = Action.None; - selectedSend: SendView; constructor(sendService: SendService, i18nService: I18nService, platformUtilsService: PlatformUtilsService, environmentService: EnvironmentService, @@ -47,40 +46,9 @@ export class SendComponent extends BaseSendComponent implements OnInit { environmentService, broadcasterService, ngZone, searchService); } - async load(filter: (send: SendView) => boolean = null) { - this.loading = true; - this.sends = await this.sendService.getAllDecrypted(); - - this.route.queryParams.subscribe(async (params) => { - this.sendId = params.sendId; - if (this.sendId != null) { - this.selectedSend = this.sends.find((s) => s.id === params.sendId); - params.action === 'edit' ? - this.action = Action.Edit : - this.action = Action.View; - return; - } - - if (params.action === 'add') { - this.action = Action.Add; - return; - } - - this.selectAll(); - }); - - this.loading = false; - this.loaded = true; - } - addSend() { - if (this.action === Action.Add) { - return; - } - this.action = Action.Add; this.sendId = null; - this.go(); } editSend(send: SendView) { @@ -90,20 +58,9 @@ export class SendComponent extends BaseSendComponent implements OnInit { selectSend(send: SendView) { this.action = Action.View; this.sendId = send.id; - this.go(); } - private go(queryParams: any = null) { - if (queryParams == null) { - queryParams = { - id: this.sendId, - action: this.action, - }; - } - this.router.navigate([], { - relativeTo: this.route, - queryParams: queryParams, - replaceUrl: true, - }); + get selectedSend() { + return this.sends.find((s) => s.id === this.sendId); } }