Commit 34f29abd authored by prumde's avatar prumde

Updated ecm-wish-list.service.ts


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@174264 ce508802-f39f-4f6c-b175-0d175dae99d5
parent d186d2df
...@@ -5,17 +5,18 @@ import 'rxjs/add/operator/catch'; ...@@ -5,17 +5,18 @@ import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/map'; import 'rxjs/add/operator/map';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { AppState } from '../../ecm-store/reducers'; import { AppState } from '../../ecm-store/reducers';
import { HostUrlService } from '../../host-url.service';
import { Item } from '../../ecm-model/product-model'; import { Item } from '../../ecm-model/product-model';
@Injectable() @Injectable()
export class EcmWishListService { export class EcmWishListService {
private wishListUrl = '/ecm/service/feeds/wishlist'; // URL to web service private wishListUrl = '/ecm/service/feeds/wishlist'; // URL to web service
wishListItems: Item[]; wishListItems: Item[];
public itemCode; public itemCode;
constructor( private http: Http, private store: Store<AppState> ) { } constructor( private http: Http, private store: Store<AppState>,public hostUrlService : HostUrlService ) { }
setWishlistItems() { setWishlistItems() {
this.fetchWishlistItems().subscribe( this.fetchWishlistItems().subscribe(
...@@ -30,10 +31,11 @@ export class EcmWishListService { ...@@ -30,10 +31,11 @@ export class EcmWishListService {
} }
fetchWishlistItems(): Observable<Item[]> { fetchWishlistItems(): Observable<Item[]> {
console.log('hostUrl: inside wishlist service fetchWishlistItems['+ this.hostUrlService.hostUrl+this.wishListUrl+']');
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.wishListUrl, options ) return this.http.get( this.hostUrlService.hostUrl+this.wishListUrl, options )
.map( (res) => this.extractData(res) ) .map( (res) => this.extractData(res) )
.catch( this.handleError ); .catch( this.handleError );
} }
...@@ -42,7 +44,7 @@ export class EcmWishListService { ...@@ -42,7 +44,7 @@ export class EcmWishListService {
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.post( '/ecm/service/feeds/wishlist/'+itemCode , options) return this.http.post( this.hostUrlService.hostUrl+'/ecm/service/feeds/wishlist/'+itemCode , options)
.map( (res) => this.extractData(res) ); .map( (res) => this.extractData(res) );
} }
...@@ -50,7 +52,7 @@ export class EcmWishListService { ...@@ -50,7 +52,7 @@ export class EcmWishListService {
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.delete( '/ecm/service/feeds/wishlist/'+itemCode, options) return this.http.delete( this.hostUrlService.hostUrl+'/ecm/service/feeds/wishlist/'+itemCode, options)
.map( (res) => this.extractData(res) ); .map( (res) => this.extractData(res) );
} }
......
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