Feature: Lazy loading
Lazy loaded everything TODO: The cash flow module when clicking on sub-links, it reloads the whole page, it needs to be diagnosed and fixed, this problem also exists in the other modules TODO: Rename folders and modules such as account to accounts to match the url
This commit is contained in:
24
overlord/src/app/core/batch.service.ts
Normal file
24
overlord/src/app/core/batch.service.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Observable} from 'rxjs/internal/Observable';
|
||||
import {catchError} from 'rxjs/operators';
|
||||
import {HttpClient, HttpParams} from '@angular/common/http';
|
||||
import {Batch} from './voucher';
|
||||
import {ErrorLoggerService} from './error-logger.service';
|
||||
|
||||
const url = '/api/batch';
|
||||
const serviceName = 'BatchService';
|
||||
|
||||
@Injectable({providedIn: 'root'})
|
||||
export class BatchService {
|
||||
|
||||
constructor(private http: HttpClient, private log: ErrorLoggerService) {
|
||||
}
|
||||
|
||||
autocomplete(date: string, term: string): Observable<Batch[]> {
|
||||
const options = {params: new HttpParams().set('t', term).set('d', date)};
|
||||
return <Observable<Batch[]>>this.http.get<Batch[]>(url, options)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'autocomplete'))
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user