bx-rest 0.0.23 → 0.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -664,6 +664,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
664
664
  }]
665
665
  }] });
666
666
 
667
+ const REST_SETTINGS = {
668
+ support: {
669
+ map: true,
670
+ result: true
671
+ },
672
+ auth: 'cookies',
673
+ urls: {
674
+ home: 'b24.trace-studio.com'
675
+ }
676
+ };
677
+
667
678
  class RestServices {
668
679
  constructor() {
669
680
  this.BX24 = false;
@@ -832,14 +843,19 @@ class SessionKeyServices extends BaseServices {
832
843
  return false;
833
844
  }
834
845
  getAuthParams() {
835
- // if (env.production && !env.component) {
836
- return this.authData$.pipe(take(1), map(v => (v) ? v.access_token : undefined));
837
- // } else {
838
- // return of(this.getAuth())
839
- // }
846
+ switch (REST_SETTINGS.auth) {
847
+ case 'cookies':
848
+ return of(this.getAuth());
849
+ default:
850
+ return this.authData$.pipe(take(1), map(v => (v) ? v.access_token : undefined));
851
+ }
840
852
  }
841
853
  getBaseUrl() {
842
- return this.authData$.pipe(map(v => (v && v.domain) ? this.prepareBaseAddress(v.domain, 'b24.trace-studio.com') : undefined));
854
+ return of(this.prepareBaseAddress(REST_SETTINGS.urls.home));
855
+ // return this.authData$.pipe( // разобраться позже
856
+ // take(1),
857
+ // map(v => (v && v.domain) ? this.prepareBaseAddress(v.domain) : undefined)
858
+ // )
843
859
  }
844
860
  }
845
861
  SessionKeyServices.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SessionKeyServices, deps: [{ token: i1$2.Store }, { token: i2$1.ActivatedRoute }, { token: RestServices }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -1205,6 +1221,7 @@ class HttpBXServices extends HttpServices {
1205
1221
  paramsClone[this.session.getKeyAuth()] = auth;
1206
1222
  return this.session.getBaseUrl().pipe(mergeMap(v => {
1207
1223
  if (v) {
1224
+ console.log('v', v);
1208
1225
  return this.http.post(this.prepareBaseAddress(v) + url, this.getHttpParamsPost(paramsClone, new FormData(), false, [], settings))
1209
1226
  .pipe(take(1), catchError(err => {
1210
1227
  if (!textError.length && err.error.error_description) {