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

@ -44,11 +44,11 @@ export class GuestBookListComponent implements OnInit {
listenToDateChange(): void {
(this.form.get('date') as FormControl).valueChanges
.pipe(map((x) => moment(x).format('DD-MMM-YYYY')))
.subscribe((x) => {
return this.ser.list(x).subscribe((list: GuestBookList) => {
.subscribe((x) =>
this.ser.list(x).subscribe((list: GuestBookList) => {
this.data.next(list.list);
});
});
}),
);
}
ngOnInit() {

View File

@ -21,36 +21,28 @@ export class GuestBookService {
get(id: string | null): Observable<GuestBook> {
const getUrl: string = id === null ? url : `${url}/${id}`;
return <Observable<GuestBook>>(
this.http
.get<GuestBook>(getUrl)
.pipe(catchError(this.log.handleError(serviceName, `get id=${id}`)))
);
return this.http
.get<GuestBook>(getUrl)
.pipe(catchError(this.log.handleError(serviceName, `get id=${id}`))) as Observable<GuestBook>;
}
list(date: string | null): Observable<GuestBookList> {
const options = { params: new HttpParams().set('q', date === null ? '' : date) };
return <Observable<GuestBookList>>(
this.http
.get<GuestBookList>(`${url}/list`, options)
.pipe(catchError(this.log.handleError(serviceName, 'list')))
);
return this.http
.get<GuestBookList>(`${url}/list`, options)
.pipe(catchError(this.log.handleError(serviceName, 'list'))) as Observable<GuestBookList>;
}
save(guestBook: GuestBook): Observable<GuestBook> {
return <Observable<GuestBook>>(
this.http
.post<GuestBook>(url, guestBook, httpOptions)
.pipe(catchError(this.log.handleError(serviceName, 'save')))
);
return this.http
.post<GuestBook>(url, guestBook, httpOptions)
.pipe(catchError(this.log.handleError(serviceName, 'save'))) as Observable<GuestBook>;
}
update(guestBook: GuestBook): Observable<GuestBook> {
return <Observable<GuestBook>>(
this.http
.put<GuestBook>(`${url}/${guestBook.id}`, guestBook, httpOptions)
.pipe(catchError(this.log.handleError(serviceName, 'update')))
);
return this.http
.put<GuestBook>(`${url}/${guestBook.id}`, guestBook, httpOptions)
.pipe(catchError(this.log.handleError(serviceName, 'update'))) as Observable<GuestBook>;
}
saveOrUpdate(guestBook: GuestBook): Observable<GuestBook> {
@ -61,10 +53,8 @@ export class GuestBookService {
}
delete(id: string): Observable<GuestBook> {
return <Observable<GuestBook>>(
this.http
.delete<GuestBook>(`${url}/${id}`, httpOptions)
.pipe(catchError(this.log.handleError(serviceName, 'delete')))
);
return this.http
.delete<GuestBook>(`${url}/${id}`, httpOptions)
.pipe(catchError(this.log.handleError(serviceName, 'delete'))) as Observable<GuestBook>;
}
}