Commit 25942503 authored by kpandey's avatar kpandey

updated

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@174980 ce508802-f39f-4f6c-b175-0d175dae99d5
parent d90e120c
...@@ -12,13 +12,12 @@ import { HostUrlService } from '../../host-url.service'; ...@@ -12,13 +12,12 @@ import { HostUrlService } from '../../host-url.service';
@Injectable() @Injectable()
export class EcmCartService { export class EcmCartService {
private userActionUrl = '/ecm/service/feeds/cart'; //private userActionUrl = '/ecm/service/feeds/L2D01/cart';
private userActionUrl = '/ecm/service/feeds';
public itemCode; public itemCode;
cartItems: ItemDetail[]; cartItems: ItemDetail[];
private SERVICE_URL = '/ecm/service/category'; // URL to web service
constructor(private http: Http, private store: Store<AppState>, private cartActions: CartActions,public hostUrlService : HostUrlService) { constructor(private http: Http, private store: Store<AppState>, private cartActions: CartActions,public hostUrlService : HostUrlService) {
} }
setCartItems(){ setCartItems(){
...@@ -39,7 +38,9 @@ private userActionUrl = '/ecm/service/feeds/cart'; ...@@ -39,7 +38,9 @@ private userActionUrl = '/ecm/service/feeds/cart';
//console.log('hostUrl: inside cart service constructor****['+this.hostUrl+']'); //console.log('hostUrl: inside cart service constructor****['+this.hostUrl+']');
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.hostUrlService.hostUrl+this.userActionUrl, options ) let siteCode = localStorage.getItem('SITE_CODE');
return this.http.get( this.hostUrlService.hostUrl+this.userActionUrl + '/' + siteCode + '/cart', options )
.map( (res) => this.extractData(res) ); .map( (res) => this.extractData(res) );
} }
...@@ -48,8 +49,9 @@ private userActionUrl = '/ecm/service/feeds/cart'; ...@@ -48,8 +49,9 @@ private userActionUrl = '/ecm/service/feeds/cart';
console.log(JSON.stringify(cartData)); console.log(JSON.stringify(cartData));
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 });
let siteCode = localStorage.getItem('SITE_CODE');
return this.http.post( this.hostUrlService.hostUrl+this.userActionUrl, JSON.stringify(cartData) , options) return this.http.post( this.hostUrlService.hostUrl+this.userActionUrl + '/' + siteCode + '/cart', JSON.stringify(cartData) , options)
.map( (res) => this.extractData(res) ); .map( (res) => this.extractData(res) );
} }
...@@ -58,15 +60,17 @@ private userActionUrl = '/ecm/service/feeds/cart'; ...@@ -58,15 +60,17 @@ private userActionUrl = '/ecm/service/feeds/cart';
console.log(JSON.stringify(cartData)); console.log(JSON.stringify(cartData));
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 });
let siteCode = localStorage.getItem('SITE_CODE');
return this.http.post(this.hostUrlService.hostUrl+ this.userActionUrl, JSON.stringify(cartData) , options) return this.http.post(this.hostUrlService.hostUrl+ this.userActionUrl + '/' + siteCode + '/cart' , JSON.stringify(cartData) , options)
.map( (res) => this.extractData(res) ); .map( (res) => this.extractData(res) );
} }
deleteCartItem( item ) { deleteCartItem( item ) {
console.log( "deleteCartItem Called" ); console.log( "deleteCartItem Called" );
let siteCode = localStorage.getItem('SITE_CODE');
return this.http.delete( this.hostUrlService.hostUrl+this.userActionUrl + '/' + item.itemCode, {}) return this.http.delete( this.hostUrlService.hostUrl+this.userActionUrl + '/' + siteCode + '/cart' + '/' + item.itemCode, {})
.map(res => res.json()); .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