basesite-shared-grid-lib 21.0.1-beta.93 → 21.0.3

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.
@@ -48,17 +48,12 @@ class GridLibraryService {
48
48
  this.setBaseUrl();
49
49
  }
50
50
  setBaseUrl(environment = "") {
51
- if (window.location.origin.includes('fcelspx')) {
52
- this.baseUrl = window.location.origin + '/designhub/api';
53
- }
54
- else if (environment == 'uat') {
55
- this.baseUrl = 'https://fcemsuat.intel.com/designhub/api';
56
- }
57
- else if (environment == 'production') {
58
- this.baseUrl = 'https://fcems.intel.com/designhub/api';
51
+ //All envs except localhost can use dynamic URL (localhost can't because it should point to test or another port)
52
+ if (window.location.origin.includes('localhost')) {
53
+ this.baseUrl = 'https://fcemstest.intel.com/designhub/api';
59
54
  }
60
55
  else {
61
- this.baseUrl = 'https://fcelspx-test.intel.com/designhub/api';
56
+ this.baseUrl = window.location.origin + '/designhub/api';
62
57
  }
63
58
  }
64
59
  getColDef(gridId) {
@@ -2764,14 +2759,8 @@ class GridLibraryComponent {
2764
2759
  if (this.enableServerSidePaging == true) {
2765
2760
  // Show loading overlay immediately when server-side paging is enabled
2766
2761
  this.gridAPI.showLoadingOverlay();
2767
- //call api
2768
- let reqHeaders = {
2769
- 'Content-type': 'application/json',
2770
- Accept: 'application/json',
2771
- Authorization: 'Bearer ' + this.token,
2772
- };
2773
2762
  // Add timeout to prevent infinite loading
2774
- const API_TIMEOUT = 800000; //80 seconds
2763
+ const API_TIMEOUT = 80000; //80 seconds
2775
2764
  let hasRetried = false;
2776
2765
  this.odataProvider = new OdataServerSideProvider({
2777
2766
  isCaseSensitiveStringFilter: false,
@@ -2782,6 +2771,15 @@ class GridLibraryComponent {
2782
2771
  const timeoutPromise = new Promise((_, reject) => {
2783
2772
  setTimeout(() => reject(new Error('API request timeout')), API_TIMEOUT);
2784
2773
  });
2774
+ // Build headers on every call so we always use the latest token.
2775
+ // Capturing the token once (e.g. at grid-ready) meant that after the
2776
+ // token expired, every subsequent filter/sort/paging request kept
2777
+ // sending the stale token and silently failed with a 401.
2778
+ const reqHeaders = {
2779
+ 'Content-type': 'application/json',
2780
+ Accept: 'application/json',
2781
+ Authorization: 'Bearer ' + this.token,
2782
+ };
2785
2783
  const fetchPromise = fetch(url, {
2786
2784
  headers: reqHeaders,
2787
2785
  })