Blacked and isorted the python files
Prettied and eslinted the typescript/html files
This commit is contained in:
@ -1,29 +1,30 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { ErrorLoggerService } from '../core/error-logger.service';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
|
||||
import { ErrorLoggerService } from '../core/error-logger.service';
|
||||
import { SectionPrinter } from '../core/section-printer';
|
||||
|
||||
const httpOptions = {
|
||||
headers: new HttpHeaders({'Content-Type': 'application/json'})
|
||||
headers: new HttpHeaders({ 'Content-Type': 'application/json' }),
|
||||
};
|
||||
const url = '/api/section-printers';
|
||||
const serviceName = 'SectionPrinterService';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class SectionPrinterService {
|
||||
constructor(private http: HttpClient, private log: ErrorLoggerService) {
|
||||
}
|
||||
constructor(private http: HttpClient, private log: ErrorLoggerService) {}
|
||||
|
||||
get(id: string): Observable<SectionPrinter[]> {
|
||||
const getUrl: string = (id === null) ? `${url}` : `${url}/${id}`;
|
||||
return <Observable<SectionPrinter[]>>this.http.get<SectionPrinter[]>(getUrl)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, `get id=${id}`))
|
||||
);
|
||||
const getUrl: string = id === null ? `${url}` : `${url}/${id}`;
|
||||
return <Observable<SectionPrinter[]>>(
|
||||
this.http
|
||||
.get<SectionPrinter[]>(getUrl)
|
||||
.pipe(catchError(this.log.handleError(serviceName, `get id=${id}`)))
|
||||
);
|
||||
}
|
||||
|
||||
// item(id: string, menuCategoryId: string): Observable<SectionPrinterItem> {
|
||||
@ -35,16 +36,18 @@ export class SectionPrinterService {
|
||||
// }
|
||||
|
||||
save(sectionId: string, list: SectionPrinter[]): Observable<SectionPrinter[]> {
|
||||
return <Observable<SectionPrinter[]>>this.http.post<SectionPrinter[]>(`${url}/${sectionId}`, list, httpOptions)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'save'))
|
||||
);
|
||||
return <Observable<SectionPrinter[]>>(
|
||||
this.http
|
||||
.post<SectionPrinter[]>(`${url}/${sectionId}`, list, httpOptions)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'save')))
|
||||
);
|
||||
}
|
||||
|
||||
delete(id: string): Observable<SectionPrinter[]> {
|
||||
return <Observable<SectionPrinter[]>>this.http.delete<SectionPrinter[]>(`${url}/${id}`, httpOptions)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'delete'))
|
||||
);
|
||||
return <Observable<SectionPrinter[]>>(
|
||||
this.http
|
||||
.delete<SectionPrinter[]>(`${url}/${id}`, httpOptions)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'delete')))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user