Chore: ng lint using the recommended @angular-eslint style
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import { inject, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SaleCategoryListResolver } from './sale-category-list-resolver.service';
|
||||
|
||||
describe('SaleCategoryListResolver', () => {
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { inject, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SaleCategoryResolver } from './sale-category-resolver.service';
|
||||
|
||||
describe('SaleCategoryResolver', () => {
|
||||
|
||||
@ -20,43 +20,37 @@ export class SaleCategoryService {
|
||||
|
||||
get(id: string | null): Observable<SaleCategory> {
|
||||
const getUrl: string = id === null ? url : `${url}/${id}`;
|
||||
return <Observable<SaleCategory>>(
|
||||
this.http
|
||||
.get<SaleCategory>(getUrl)
|
||||
.pipe(catchError(this.log.handleError(serviceName, `get id=${id}`)))
|
||||
);
|
||||
return this.http
|
||||
.get<SaleCategory>(getUrl)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, `get id=${id}`)),
|
||||
) as Observable<SaleCategory>;
|
||||
}
|
||||
|
||||
list(): Observable<SaleCategory[]> {
|
||||
return <Observable<SaleCategory[]>>(
|
||||
this.http
|
||||
.get<SaleCategory[]>(`${url}/list`)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'list')))
|
||||
);
|
||||
return this.http
|
||||
.get<SaleCategory[]>(`${url}/list`)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'list'))) as Observable<SaleCategory[]>;
|
||||
}
|
||||
|
||||
listForDiscount(): Observable<{ name: string; discount: number }[]> {
|
||||
return <Observable<{ name: string; discount: number }[]>>(
|
||||
this.http
|
||||
.get<{ name: string; discount: number }[]>(`${url}/for-discount`)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'list')))
|
||||
);
|
||||
return this.http
|
||||
.get<{ name: string; discount: number }[]>(`${url}/for-discount`)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'list'))) as Observable<
|
||||
{ name: string; discount: number }[]
|
||||
>;
|
||||
}
|
||||
|
||||
save(saleCategory: SaleCategory): Observable<SaleCategory> {
|
||||
return <Observable<SaleCategory>>(
|
||||
this.http
|
||||
.post<SaleCategory>(url, saleCategory, httpOptions)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'save')))
|
||||
);
|
||||
return this.http
|
||||
.post<SaleCategory>(url, saleCategory, httpOptions)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'save'))) as Observable<SaleCategory>;
|
||||
}
|
||||
|
||||
update(saleCategory: SaleCategory): Observable<SaleCategory> {
|
||||
return <Observable<SaleCategory>>(
|
||||
this.http
|
||||
.put<SaleCategory>(`${url}/${saleCategory.id}`, saleCategory, httpOptions)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'update')))
|
||||
);
|
||||
return this.http
|
||||
.put<SaleCategory>(`${url}/${saleCategory.id}`, saleCategory, httpOptions)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'update'))) as Observable<SaleCategory>;
|
||||
}
|
||||
|
||||
saveOrUpdate(saleCategory: SaleCategory): Observable<SaleCategory> {
|
||||
@ -67,10 +61,8 @@ export class SaleCategoryService {
|
||||
}
|
||||
|
||||
delete(id: string): Observable<SaleCategory> {
|
||||
return <Observable<SaleCategory>>(
|
||||
this.http
|
||||
.delete<SaleCategory>(`${url}/${id}`, httpOptions)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'delete')))
|
||||
);
|
||||
return this.http
|
||||
.delete<SaleCategory>(`${url}/${id}`, httpOptions)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'delete'))) as Observable<SaleCategory>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user