Skip to content

Commit

Permalink
Fix URM-196244
Browse files Browse the repository at this point in the history
Incite integration doesn't work in PROD environments
Send the query params for http post only
  • Loading branch information
avichai-exlibris committed Jun 7, 2023
1 parent 9cf12c3 commit da63a89
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions cloudapp/src/app/service/InCites.api.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { CloudAppEventsService, InitData } from '@exlibris/exl-cloudapp-angular-lib';
import { mergeMap } from 'rxjs/operators';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { HttpClient } from '@angular/common/http';
import { BaseService } from './base.service';
@Injectable({
providedIn: 'root'
Expand All @@ -10,6 +10,7 @@ import { BaseService } from './base.service';

export class InCitesApiService extends BaseService {
private _toConnect : boolean;
private _isQueryParamsNeeded : boolean = false;
private _authorization : any;

constructor(
Expand All @@ -26,6 +27,7 @@ export class InCitesApiService extends BaseService {
return this.getInitData().pipe(
mergeMap(initData => {
console.log("init data = " + initData);
this._isQueryParamsNeeded = true;
fullUrl = this.setBaseUrl(initData);
return this.getAuthToken()
}),
Expand All @@ -42,13 +44,13 @@ export class InCitesApiService extends BaseService {
return this.getInitData().pipe(
mergeMap(initData => {
console.log("init data = " + initData);
this._isQueryParamsNeeded = false;
fullUrl = this.setBaseUrl(initData);
return this.getAuthToken()
}),
mergeMap(authToken => {
let headers = this.setAuthHeader(authToken);
this._authorization = headers.Authorization;

return this.http.get<any>(fullUrl, { })
})
);
Expand All @@ -57,7 +59,10 @@ export class InCitesApiService extends BaseService {
setBaseUrl(initData: InitData) : string {
let baseUrl = super.setBaseUrl(initData);
baseUrl = baseUrl + "inCites?";
baseUrl = baseUrl + this.getQueryParams();
if (this._isQueryParamsNeeded) {
baseUrl = baseUrl + this.getQueryParams();

}
return baseUrl;
}

Expand All @@ -66,7 +71,6 @@ export class InCitesApiService extends BaseService {
urlParams = urlParams + QueryParams.Optin + "=" + this._toConnect +"&" + QueryParams.Jwt + "=" + this._authorization;
return urlParams;
}

}

export enum QueryParams {
Expand Down

0 comments on commit da63a89

Please sign in to comment.