Added error handling for edit employee
This commit is contained in:
@@ -82,29 +82,6 @@ export class EmployeeService extends UnsubscribeDirective {
|
||||
.subscribe(employee => {
|
||||
this._employee$.next(employee as Employee);
|
||||
})
|
||||
// this._currentEmployeeId$
|
||||
// .pipe(
|
||||
// filter(currentEmployeeId => !!currentEmployeeId),
|
||||
// switchMap(currentEmployeeId =>
|
||||
// combineLatest([this._fetchEmployee$(currentEmployeeId), this.tjanstService.tjanster$]).pipe(
|
||||
// filter(([employee, allTjanster]) => !!(employee && allTjanster?.length)),
|
||||
// map(([employee, allTjanster]) => {
|
||||
// const tjanster = [];
|
||||
// employee.tjanstCodes?.forEach(code => {
|
||||
// const currentTjanst = allTjanster.find(tjanst => tjanst.code === code);
|
||||
|
||||
// if (currentTjanst) {
|
||||
// tjanster.push(currentTjanst);
|
||||
// }
|
||||
// });
|
||||
// return { ...employee, tjanster };
|
||||
// })
|
||||
// )
|
||||
// )
|
||||
// )
|
||||
// .subscribe(employee => {
|
||||
// this._employee$.next(employee as Employee);
|
||||
// })
|
||||
);
|
||||
}
|
||||
|
||||
@@ -215,7 +192,7 @@ export class EmployeeService extends UnsubscribeDirective {
|
||||
map(({ data }) => data),
|
||||
catchError(error => {
|
||||
this.errorService.add(errorToCustomError(error));
|
||||
return of(null);
|
||||
return throwError(errorToCustomError(error));
|
||||
})
|
||||
);
|
||||
}
|
||||
@@ -229,8 +206,7 @@ export class EmployeeService extends UnsubscribeDirective {
|
||||
}),
|
||||
map(() => true),
|
||||
catchError(error => {
|
||||
this.errorService.add(errorToCustomError(error));
|
||||
return of(false);
|
||||
return throwError(errorToCustomError(error));
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user