deleted most of the send component

This commit is contained in:
addison 2021-02-03 23:19:42 -05:00
parent 2b9bae6807
commit 8479e57fa5
1 changed files with 2 additions and 45 deletions

View File

@ -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);
}
}