Skip to content

Commit

Permalink
linter fix
Browse files Browse the repository at this point in the history
  • Loading branch information
amrmahdyy committed Jan 31, 2025
1 parent 5e1195f commit d810f29
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@ export class StaffEditComponent implements OnDestroy, OnInit {
await firstValueFrom(this.route.paramMap.pipe())
).get('staffId')) ?? undefined;
await this.getStaff();

this.form.controls.endDate.valueChanges
.pipe(takeUntil(this.destroy))
.subscribe({
next: (endDate) => {
if (typeof endDate == 'string' && endDate == '') {
this.form.controls.endDate.setValue(null, { emitEvent: false });
}
},
error: console.error,
});
}

private destroy = new Subject<void>();
Expand All @@ -95,15 +106,7 @@ export class StaffEditComponent implements OnDestroy, OnInit {
private route: ActivatedRoute,
private staffDetailsService: StaffDetailsService,
private toastService: ToastService,
) {
this.form.controls.endDate.valueChanges
.pipe(takeUntil(this.destroy))
.subscribe((endDate) => {
if (typeof endDate == 'string' && endDate == '') {
this.form.controls.endDate.setValue(null, { emitEvent: false });
}
});
}
) {}

async submit() {
this.form.markAllAsTouched();
Expand Down

0 comments on commit d810f29

Please sign in to comment.