@fluxo-dev/api-client-base 25.3.1 → 25.3.2

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.
Files changed (2) hide show
  1. package/index.cjs.js +8 -6
  2. package/package.json +2 -2
package/index.cjs.js CHANGED
@@ -2637,6 +2637,11 @@ $$k({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
2637
2637
  }
2638
2638
  });
2639
2639
 
2640
+ const LocalStorageConstants = {
2641
+ accessToken: 'access-token',
2642
+ userData: 'user-data'
2643
+ };
2644
+
2640
2645
  let HttpClient$1 = class HttpClient {
2641
2646
  get client() {
2642
2647
  return this._axiosInstance;
@@ -2654,7 +2659,9 @@ let HttpClient$1 = class HttpClient {
2654
2659
  const state$1 = state.store.getState();
2655
2660
  if (state$1.user.loggedIn) {
2656
2661
  return Object.assign(Object.assign({}, config), {
2657
- headers: Object.assign({}, config.headers)
2662
+ headers: Object.assign(Object.assign({}, config.headers), {
2663
+ 'Authorization': 'Bearer ' + localStorage.getItem(LocalStorageConstants.accessToken)
2664
+ })
2658
2665
  });
2659
2666
  }
2660
2667
  return config;
@@ -2785,11 +2792,6 @@ if ($stringify) {
2785
2792
 
2786
2793
  function e(e){this.message=e;}e.prototype=new Error,e.prototype.name="InvalidCharacterError";var r="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(r){var t=String(r).replace(/=+$/,"");if(t.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,a=0,i=0,c="";o=t.charAt(i++);~o&&(n=a%4?64*n+o:o,a++%4)?c+=String.fromCharCode(255&n>>(-2*a&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return c};function t(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw "Illegal base64url string!"}try{return function(e){return decodeURIComponent(r(e).replace(/(.)/g,(function(e,r){var t=r.charCodeAt(0).toString(16).toUpperCase();return t.length<2&&(t="0"+t),"%"+t})))}(t)}catch(e){return r(t)}}function n(e){this.message=e;}function o(e,r){if("string"!=typeof e)throw new n("Invalid token specified");var o=true===(r=r||{}).header?0:1;try{return JSON.parse(t(e.split(".")[o]))}catch(e){throw new n("Invalid token specified: "+e.message)}}n.prototype=new Error,n.prototype.name="InvalidTokenError";
2787
2794
 
2788
- const LocalStorageConstants = {
2789
- accessToken: 'access-token',
2790
- userData: 'user-data'
2791
- };
2792
-
2793
2795
  class FluxoStateDispatcher {
2794
2796
  static dispatchUserLogin(data) {
2795
2797
  state.store.dispatch(state.userLogin(data));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluxo-dev/api-client-base",
3
- "version": "25.3.1",
3
+ "version": "25.3.2",
4
4
  "type": "commonjs",
5
5
  "peerDependencies": {
6
6
  "react": "^18.3.1",
@@ -8,7 +8,7 @@
8
8
  "react-router-dom": "^6.11.2",
9
9
  "react-redux": "^8.0.5",
10
10
  "@reduxjs/toolkit": "^1.9.1",
11
- "@fluxo-dev/state": "^25.3.1"
11
+ "@fluxo-dev/state": "^25.3.2"
12
12
  },
13
13
  "main": "./index.cjs.js",
14
14
  "types": "./index.cjs.d.ts"