Fix: FormArrays were not getting cleared and were basically fucking the whole thing up.

Fix: EmployeeAttendance was borking because the inital employee was null.
This commit is contained in:
2022-07-24 18:25:02 +05:30
parent c7bc379032
commit 4b97c4228a
9 changed files with 22 additions and 15 deletions
@@ -1,6 +1,6 @@
import { HttpClient, HttpParams } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/internal/Observable';
import { Observable, of as observableOf } from 'rxjs';
import { catchError } from 'rxjs/operators';
import { ErrorLoggerService } from '../core/error-logger.service';
@@ -35,6 +35,9 @@ export class EmployeeAttendanceService {
}
save(employeeAttendance: EmployeeAttendance): Observable<EmployeeAttendance> {
if (!employeeAttendance.employee) {
return observableOf(new EmployeeAttendance());
}
const { id } = employeeAttendance.employee;
return this.http
.post<EmployeeAttendance>(`${url}/${id}`, employeeAttendance)