Commit 6eed161d authored by prumde's avatar prumde

Updated ecm-category.service.ts


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@174519 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 82d66ffe
...@@ -6,26 +6,27 @@ import 'rxjs/add/operator/map'; ...@@ -6,26 +6,27 @@ import 'rxjs/add/operator/map';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { Category } from '../../ecm-model/category-model'; import { Category } from '../../ecm-model/category-model';
import { HostUrlService } from '../../host-url.service';
@Injectable() @Injectable()
export class EcmCategoryService { export class EcmCategoryService {
private SERVICE_URL = '/ecm/service/category'; // URL to web service private SERVICE_URL = '/ecm/service/category'; // URL to web service
constructor (private http: Http,) {} constructor (private http: Http,public hostUrlService : HostUrlService) {}
getCategories(): Observable<Category[]> { getCategories(): Observable<Category[]> {
let headers = new Headers( { 'Content-Type': 'application/json' }); let headers = new Headers( { 'Content-Type': 'application/json' });
let options = new RequestOptions( { headers: headers }); let options = new RequestOptions( { headers: headers });
console.log('inside get category'+this.hostUrlService.hostUrl)
return this.http.get( this.SERVICE_URL, options ) return this.http.get( this.hostUrlService.hostUrl+this.SERVICE_URL, options )
.map( this.extractData ) .map( this.extractData )
.catch( this.handleError ); .catch( this.handleError );
} }
getCategory (catCode : string): Observable<Category> { getCategory (catCode : string): Observable<Category> {
let categoryUrl = this.SERVICE_URL + '/' + catCode; let categoryUrl = this.hostUrlService.hostUrl+this.SERVICE_URL + '/' + catCode;
let headers = new Headers({ 'Content-Type': 'application/json' }); let headers = new Headers({ 'Content-Type': 'application/json' });
let options = new RequestOptions({ headers: headers }); let options = new RequestOptions({ headers: headers });
...@@ -38,7 +39,7 @@ export class EcmCategoryService { ...@@ -38,7 +39,7 @@ export class EcmCategoryService {
let headers = new Headers( { 'Content-Type': 'application/json' }); let headers = new Headers( { 'Content-Type': 'application/json' });
let options = new RequestOptions( { headers: headers }); let options = new RequestOptions( { headers: headers });
return this.http.get( this.SERVICE_URL + '/summary', options ) return this.http.get( this.hostUrlService.hostUrl+this.SERVICE_URL + '/summary', options )
.map( this.extractData ) .map( this.extractData )
.catch( this.handleError ); .catch( this.handleError );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment