Chore: ng lint using the recommended @angular-eslint style

This commit is contained in:
2020-12-08 18:50:46 +05:30
parent 130d9197e5
commit d65379a068
50 changed files with 524 additions and 636 deletions

View File

@ -20,35 +20,27 @@ export class UserService {
get(id: string | null): Observable<User> {
const getUrl: string = id === null ? `${url}` : `${url}/${id}`;
return <Observable<User>>(
this.http
.get<User>(getUrl)
.pipe(catchError(this.log.handleError(serviceName, `get id=${id}`)))
);
return this.http
.get<User>(getUrl)
.pipe(catchError(this.log.handleError(serviceName, `get id=${id}`))) as Observable<User>;
}
list(): Observable<User[]> {
return <Observable<User[]>>(
this.http
.get<User[]>(`${url}/list`)
.pipe(catchError(this.log.handleError(serviceName, 'list')))
);
return this.http
.get<User[]>(`${url}/list`)
.pipe(catchError(this.log.handleError(serviceName, 'list'))) as Observable<User[]>;
}
save(user: User): Observable<User> {
return <Observable<User>>(
this.http
.post<User>(`${url}`, user, httpOptions)
.pipe(catchError(this.log.handleError(serviceName, 'save')))
);
return this.http
.post<User>(`${url}`, user, httpOptions)
.pipe(catchError(this.log.handleError(serviceName, 'save'))) as Observable<User>;
}
update(user: User): Observable<User> {
return <Observable<User>>(
this.http
.put<User>(`${url}/${user.id}`, user, httpOptions)
.pipe(catchError(this.log.handleError(serviceName, 'update')))
);
return this.http
.put<User>(`${url}/${user.id}`, user, httpOptions)
.pipe(catchError(this.log.handleError(serviceName, 'update'))) as Observable<User>;
}
saveOrUpdate(user: User): Observable<User> {
@ -59,10 +51,8 @@ export class UserService {
}
delete(id: string): Observable<User> {
return <Observable<User>>(
this.http
.delete<User>(`${url}/${id}`, httpOptions)
.pipe(catchError(this.log.handleError(serviceName, 'delete')))
);
return this.http
.delete<User>(`${url}/${id}`, httpOptions)
.pipe(catchError(this.log.handleError(serviceName, 'delete'))) as Observable<User>;
}
}