I'm modifying the Angular 8 code of another developer and found this method:
retrieveByExperience(experienceId: number): Observable<any[]> {
return this.http.get<OrganisationCode[]>(environment.serverUrl + `api/expert/experiences/${experienceId}/organisationTypes`)
.pipe(
map((data: OrganisationCode[]) => {
return data;
}),
catchError(err =>
throwError(err)
)
);
}
The pipe seems to just return the same data obtained from the backend or rethrow the same error it caught... Can it be safely removed?
Here is an example without the pipe, that seems to behave the same way:
retrieveByExperience(experienceId: number): Observable<any[]> {
return this.http.get<OrganisationCode[]>(environment.serverUrl + `api/expert/experiences/${experienceId}/organisationTypes`);
}
Yes, both are perfectly redundant.
Maybe they're some forgotten TODOs: "to implement some processing", "to implement custom error handler".