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:
@@ -3,13 +3,12 @@ import {HttpClient, HttpHeaders, HttpParams} from '@angular/common/http';
|
||||
import {ErrorLoggerService} from '../core/error-logger.service';
|
||||
import {catchError} from 'rxjs/operators';
|
||||
import {Observable} from 'rxjs/internal/Observable';
|
||||
import {User} from './user';
|
||||
import {Group} from '../group/group';
|
||||
import {User} from '../core/user';
|
||||
|
||||
const httpOptions = {
|
||||
headers: new HttpHeaders({'Content-Type': 'application/json'})
|
||||
};
|
||||
const url = '/api/User';
|
||||
const url = '/api/users';
|
||||
const serviceName = 'UserService';
|
||||
|
||||
@Injectable({
|
||||
@@ -20,7 +19,7 @@ export class UserService {
|
||||
}
|
||||
|
||||
get(id: string): Observable<User> {
|
||||
const getUrl: string = (id === null) ? url : `${url}/${id}`;
|
||||
const getUrl: string = (id === null) ? `${url}/new` : `${url}/${id}`;
|
||||
return <Observable<User>>this.http.get<User>(getUrl)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, `get id=${id}`))
|
||||
@@ -44,7 +43,7 @@ export class UserService {
|
||||
}
|
||||
|
||||
save(user: User): Observable<User> {
|
||||
return <Observable<User>>this.http.post<User>(url, user, httpOptions)
|
||||
return <Observable<User>>this.http.post<User>(`${url}/new`, user, httpOptions)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'save'))
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user