Commit 82d66ffe authored by prumde's avatar prumde

Updated ecm-cart.service.ts


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@174518 ce508802-f39f-4f6c-b175-0d175dae99d5
parent bfa14277
......@@ -8,6 +8,7 @@ import { Store } from '@ngrx/store';
import {AppState} from '../../ecm-store/reducers';
import {CartActions} from '../../ecm-store/actions';
import { HostUrlService } from '../../host-url.service';
@Injectable()
export class EcmCartService {
......@@ -16,8 +17,10 @@ private userActionUrl = '/ecm/service/feeds/cart';
public itemCode;
cartItems: ItemDetail[];
constructor(private http: Http, private store: Store<AppState>, private cartActions: CartActions) { }
private SERVICE_URL = '/ecm/service/category'; // URL to web service
constructor(private http: Http, private store: Store<AppState>, private cartActions: CartActions,public hostUrlService : HostUrlService) {
}
setCartItems(){
this.fetchCartItems().subscribe(
data => {
......@@ -32,10 +35,11 @@ private userActionUrl = '/ecm/service/feeds/cart';
fetchCartItems(): Observable<ItemDetail[]> {
console.log('hostUrl: inside cart service constructor['+this.hostUrlService.hostUrl+']');
//console.log('hostUrl: inside cart service constructor****['+this.hostUrl+']');
let headers = new Headers( { 'Content-Type': 'application/json' });
let options = new RequestOptions( { headers: headers });
return this.http.get( this.userActionUrl, options )
return this.http.get( this.hostUrlService.hostUrl+this.userActionUrl, options )
.map( (res) => this.extractData(res) );
}
......@@ -45,7 +49,7 @@ private userActionUrl = '/ecm/service/feeds/cart';
let headers = new Headers( { 'Content-Type': 'application/json' });
let options = new RequestOptions( { headers: headers });
return this.http.post( '/ecm/service/feeds/cart', JSON.stringify(cartData) , options)
return this.http.post( this.hostUrlService.hostUrl+this.SERVICE_URL, JSON.stringify(cartData) , options)
.map( (res) => this.extractData(res) );
}
......@@ -55,14 +59,14 @@ private userActionUrl = '/ecm/service/feeds/cart';
let headers = new Headers( { 'Content-Type': 'application/json' });
let options = new RequestOptions( { headers: headers });
return this.http.post( '/ecm/service/feeds/cart', JSON.stringify(cartData) , options)
return this.http.post(this.hostUrlService.hostUrl+ this.userActionUrl, JSON.stringify(cartData) , options)
.map( (res) => this.extractData(res) );
}
deleteCartItem( item ) {
console.log( "deleteCartItem Called" );
return this.http.delete( this.userActionUrl + '/' + item.itemCode, {})
return this.http.delete( this.hostUrlService.hostUrl+this.userActionUrl + '/' + item.itemCode, {})
.map(res => res.json());
}
......
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