Commit b6f42e01 authored by kpandey's avatar kpandey

updated

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@174993 ce508802-f39f-4f6c-b175-0d175dae99d5
parent ab74595e
......@@ -14,8 +14,9 @@ import { HostUrlService } from '../host-url.service';
@Injectable()
export class UserReviewService {
private userActionUrl = '/ecm/service/feeds/review';
// private userActionUrl = '/ecm/service/feeds/L2D01/review';
private userActionUrl = '/ecm/service/feeds';
userReview: Review[];
value;
......@@ -39,8 +40,9 @@ export class UserReviewService {
let headers = new Headers( { 'Content-Type': 'application/json' });
let options = new RequestOptions( { headers: headers });
return this.http.get( this.userActionUrl, options )
let siteCode = localStorage.getItem('SITE_CODE');
return this.http.get( this.userActionUrl + '/' + siteCode + '/review' , options )
.map(( res ) => this.extractData( res ) );
}
......@@ -49,26 +51,29 @@ export class UserReviewService {
console.log( JSON.stringify( userReview ) );
let headers = new Headers( { 'Content-Type': 'application/json' });
let options = new RequestOptions( { headers: headers });
let siteCode = localStorage.getItem('SITE_CODE');
return this.http.post( '', JSON.stringify( userReview ), options )
.map(( res ) => this.extractData( res ) );
}
deleteCartItem( userReview ) {
console.log( "deleteUserreview Called" );
return this.http.delete( this.hostUrlService.hostUrl + this.userActionUrl + '/' + userReview.userCode, {})
let siteCode = localStorage.getItem('SITE_CODE');
return this.http.delete( this.hostUrlService.hostUrl + this.userActionUrl + '/' + siteCode + '/review' + '/' + userReview.userCode, {})
.map( res => res.json() );
}
getUserReview( itemCode ) {
console.log( "URL: " + this.hostUrlService.hostUrl+this.userActionUrl );
let siteCode = localStorage.getItem('SITE_CODE');
let headers = new Headers( { 'Content-Type': 'application/json' });
let options = new RequestOptions( { headers: headers });
return this.http.get( this.hostUrlService.hostUrl+this.userActionUrl + '/'+ itemCode, options )
return this.http.get( this.hostUrlService.hostUrl+this.userActionUrl + '/' + siteCode + '/review' + '/' + itemCode, options )
.map( this.extractData )
.catch( this.handleError );
}
......@@ -76,11 +81,12 @@ export class UserReviewService {
submitReview(reviewData){
let headers = new Headers( { 'Content-Type': 'application/json' });
let options = new RequestOptions( { headers: headers });
let siteCode = localStorage.getItem('SITE_CODE');
console.log("Submitting Review...");
console.log(JSON.stringify(reviewData));
this.http.post(this.hostUrlService.hostUrl+this.userActionUrl, reviewData, options)
this.http.post(this.hostUrlService.hostUrl+this.userActionUrl + '/' + siteCode + '/review' , reviewData, options)
.subscribe(data => {
console.log("Add Review");
}, error => {
......@@ -91,10 +97,11 @@ export class UserReviewService {
removeReview(itemCode){
let headers = new Headers( { 'Content-Type': 'application/json' });
let options = new RequestOptions( { headers: headers });
let siteCode = localStorage.getItem('SITE_CODE');
console.log("Deleting Review for...",itemCode);
this.http.delete(this.hostUrlService.hostUrl+this.userActionUrl+itemCode, options)
this.http.delete(this.hostUrlService.hostUrl+this.userActionUrl + '/' + siteCode + '/review' + '/' + itemCode, options)
.subscribe(data => {
console.log("Deleted Review");
}, error => {
......
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