@coscine/api-client 1.5.2 → 2.0.0

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.
package/README.md CHANGED
@@ -19,3 +19,4 @@ Furthermore, some setup is done, to deliver an easy API connection for our Cosci
19
19
  ## Links
20
20
 
21
21
  Bundles the output of [CodeGen](https://git.rwth-aachen.de/coscine/backend/scripts/codegen).
22
+
package/dist/index.js CHANGED
@@ -8596,15 +8596,15 @@ function implementations(axios) {
8596
8596
 
8597
8597
  const instance = axios.create();
8598
8598
  const authHeaderKey = 'Authorization';
8599
- const clientCorrolationIdKey = 'X-Coscine-Logging-CorrelationId';
8599
+ const clientCorrelationIdKey = 'X-Coscine-Logging-CorrelationId';
8600
8600
  function setHeader(request) {
8601
8601
  if (typeof coscine !== "undefined") {
8602
8602
  if (typeof coscine.authorization !== "undefined") {
8603
8603
  request.headers.common[authHeaderKey] =
8604
8604
  'Bearer ' + coscine.authorization.bearer;
8605
8605
  }
8606
- if (typeof coscine.clientcorrolation !== "undefined") {
8607
- request.headers.common[clientCorrolationIdKey] = coscine.clientcorrolation.id;
8606
+ if (typeof coscine.clientcorrelation !== "undefined") {
8607
+ request.headers.common[clientCorrelationIdKey] = coscine.clientcorrelation.id;
8608
8608
  }
8609
8609
  }
8610
8610
  if (typeof window !== 'undefined') {
@@ -8614,46 +8614,21 @@ function setHeader(request) {
8614
8614
  request.headers.common[authHeaderKey] =
8615
8615
  'Bearer ' + localStorageToken;
8616
8616
  }
8617
- const localStorageClientCorrelation = localStorage.getItem("coscine.clientcorrolation.id");
8617
+ const localStorageClientCorrelation = localStorage.getItem("coscine.clientcorrelation.id");
8618
8618
  if (localStorageClientCorrelation) {
8619
- request.headers.common[clientCorrolationIdKey] = localStorageClientCorrelation;
8620
- }
8621
- }
8622
- }
8623
- function increaseLoading() {
8624
- if ((typeof coscine !== "undefined") && (typeof coscine.loading !== "undefined") && (typeof coscine.loading.counter !== "undefined")) {
8625
- coscine.loading.counter++;
8626
- }
8627
- if (typeof window !== 'undefined') {
8628
- const localStorageLoading = localStorage.getItem("coscine.loading.counter");
8629
- if (localStorageLoading) {
8630
- localStorage.setItem("coscine.loading.counter", String(Number(localStorageLoading) + 1));
8631
- }
8632
- }
8633
- }
8634
- function decreaseLoading() {
8635
- if ((typeof coscine !== "undefined") && (typeof coscine.loading !== "undefined") && (typeof coscine.loading.counter !== "undefined")) {
8636
- coscine.loading.counter--;
8637
- }
8638
- if (typeof window !== 'undefined') {
8639
- const localStorageLoading = localStorage.getItem("coscine.loading.counter");
8640
- if (localStorageLoading) {
8641
- localStorage.setItem("coscine.loading.counter", String(Number(localStorageLoading) - 1));
8619
+ request.headers.common[clientCorrelationIdKey] = localStorageClientCorrelation;
8642
8620
  }
8643
8621
  }
8644
8622
  }
8645
8623
  instance.interceptors.request.use((request) => {
8646
8624
  setHeader(request);
8647
- increaseLoading();
8648
8625
  return request;
8649
8626
  }, (error) => {
8650
8627
  return Promise.reject(error);
8651
8628
  });
8652
8629
  instance.interceptors.response.use((response) => {
8653
- decreaseLoading();
8654
8630
  return response;
8655
8631
  }, (error) => {
8656
- decreaseLoading();
8657
8632
  return Promise.reject(error);
8658
8633
  });
8659
8634