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:
Amritanshu
2019-06-13 16:36:43 +05:30
parent fea48e1a3e
commit 72044476a8
184 changed files with 786 additions and 664 deletions
+4 -4
View File
@@ -2,14 +2,14 @@ import {Injectable} from '@angular/core';
import {Observable} from 'rxjs/internal/Observable';
import {catchError} from 'rxjs/operators';
import {HttpClient, HttpHeaders, HttpParams} from '@angular/common/http';
import {Product} from './product';
import {Product} from '../core/product';
import {ErrorLoggerService} from '../core/error-logger.service';
const httpOptions = {
headers: new HttpHeaders({'Content-Type': 'application/json'})
};
const url = '/api/Product';
const url = '/api/products';
const serviceName = 'ProductService';
@Injectable({providedIn: 'root'})
@@ -19,7 +19,7 @@ export class ProductService {
}
get(id: string): Observable<Product> {
const getUrl: string = (id === null) ? url : `${url}/${id}`;
const getUrl: string = (id === null) ? `${url}/new` : `${url}/${id}`;
return <Observable<Product>>this.http.get<Product>(getUrl)
.pipe(
catchError(this.log.handleError(serviceName, `get id=${id}`))
@@ -35,7 +35,7 @@ export class ProductService {
}
save(product: Product): Observable<Product> {
return <Observable<Product>>this.http.post<Product>(url, product, httpOptions)
return <Observable<Product>>this.http.post<Product>(`${url}/new`, product, httpOptions)
.pipe(
catchError(this.log.handleError(serviceName, 'save'))
);