Commit 803f5dd3 authored by prumde's avatar prumde

Updated ecm-product-detail.service.ts and ecm-product-review.service.ts


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@174252 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 9ae78a2a
...@@ -6,17 +6,18 @@ import 'rxjs/add/operator/map'; ...@@ -6,17 +6,18 @@ import 'rxjs/add/operator/map';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { ItemDetail } from '../ecm-model/product-detail-model'; import { ItemDetail } from '../ecm-model/product-detail-model';
import { HostUrlService } from '../host-url.service';
@Injectable() @Injectable()
export class EcmProductDetailService { export class EcmProductDetailService {
private SERVICE_URL = '/ecm/service/category/detail/'; // URL to web service private SERVICE_URL = '/ecm/service/category/detail/'; // URL to web service
constructor (private http: Http) {} constructor ( public hostUrlService : HostUrlService,private http: Http) {}
getItemDetail (itemCode : string): Observable<ItemDetail> { getItemDetail (itemCode : string): Observable<ItemDetail> {
let itemsUrl = this.SERVICE_URL + itemCode ; let itemsUrl = this.hostUrlService.hostUrl+this.SERVICE_URL + itemCode ;
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 });
......
...@@ -5,19 +5,20 @@ import 'rxjs/add/operator/catch'; ...@@ -5,19 +5,20 @@ import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/map'; import 'rxjs/add/operator/map';
import { Reviews } from '../ecm-model/product-review.model'; import { Reviews } from '../ecm-model/product-review.model';
import { HostUrlService } from '../host-url.service';
@Injectable() @Injectable()
export class EcmProductReviewService { export class EcmProductReviewService {
constructor(private http: Http) { } constructor( public hostUrlService : HostUrlService,private http: Http) { }
getReviews(solrUrl) { getReviews(solrUrl) {
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( solrUrl, options ) return this.http.get( this.hostUrlService.hostUrl+solrUrl, options )
.map( this.extractData ) .map( this.extractData )
.catch( this.handleError ); .catch( this.handleError );
...@@ -31,7 +32,7 @@ export class EcmProductReviewService { ...@@ -31,7 +32,7 @@ export class EcmProductReviewService {
console.log("Inside Update Likes "+itemCode); console.log("Inside Update Likes "+itemCode);
console.log(JSON.stringify(data)); console.log(JSON.stringify(data));
this.http.post(userServiceUrl, data, options) this.http.post( this.hostUrlService.hostUrl+userServiceUrl, data, options)
.subscribe(data => { .subscribe(data => {
console.log("Updated Likes"); console.log("Updated Likes");
}, error => { }, error => {
...@@ -47,7 +48,7 @@ export class EcmProductReviewService { ...@@ -47,7 +48,7 @@ export class EcmProductReviewService {
console.log("Submitting Review..."); console.log("Submitting Review...");
console.log(JSON.stringify(reviewData)); console.log(JSON.stringify(reviewData));
this.http.post(userServiceUrl, reviewData, options) this.http.post( this.hostUrlService.hostUrl+userServiceUrl, reviewData, options)
.subscribe(data => { .subscribe(data => {
console.log("Add Review"); console.log("Add Review");
}, error => { }, error => {
...@@ -63,7 +64,7 @@ export class EcmProductReviewService { ...@@ -63,7 +64,7 @@ export class EcmProductReviewService {
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( getUserReviewUrl, options ) return this.http.get( this.hostUrlService.hostUrl+ getUserReviewUrl, 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