Chore: ng lint using the recommended @angular-eslint style
This commit is contained in:
@ -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() {
|
||||
|
||||
@ -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>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user