@fctc/interface-logic 3.6.7 → 3.6.8

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/dist/configs.js CHANGED
@@ -2277,17 +2277,17 @@ var axiosClient = {
2277
2277
  paramsSerializer: (params) => new URLSearchParams(params).toString()
2278
2278
  });
2279
2279
  instance.interceptors.request.use(async (config2) => {
2280
- const { useRefreshToken, useActionToken, actionToken } = config2;
2280
+ const useRefreshToken = config2.headers["X-Use-Refresh-Token"] === "true";
2281
+ const useActionToken = config2.headers["X-Use-Action-Token"] === "true";
2282
+ const actionToken = config2.headers["X-Action-Token"];
2281
2283
  console.log("config", config2);
2282
2284
  console.log("useRefreshToken", useRefreshToken);
2283
2285
  let token = null;
2284
2286
  if (useActionToken && actionToken) {
2285
2287
  token = actionToken;
2286
- }
2287
- if (useRefreshToken) {
2288
- token = await localStorage2.getRefreshToken();
2289
- } else if (!useRefreshToken && !useActionToken) {
2290
- token = await localStorage2.getAccessToken();
2288
+ } else {
2289
+ const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
2290
+ token = await getToken?.();
2291
2291
  }
2292
2292
  if (token) {
2293
2293
  config2.headers["Authorization"] = `Bearer ${token}`;
package/dist/configs.mjs CHANGED
@@ -2241,17 +2241,17 @@ var axiosClient = {
2241
2241
  paramsSerializer: (params) => new URLSearchParams(params).toString()
2242
2242
  });
2243
2243
  instance.interceptors.request.use(async (config2) => {
2244
- const { useRefreshToken, useActionToken, actionToken } = config2;
2244
+ const useRefreshToken = config2.headers["X-Use-Refresh-Token"] === "true";
2245
+ const useActionToken = config2.headers["X-Use-Action-Token"] === "true";
2246
+ const actionToken = config2.headers["X-Action-Token"];
2245
2247
  console.log("config", config2);
2246
2248
  console.log("useRefreshToken", useRefreshToken);
2247
2249
  let token = null;
2248
2250
  if (useActionToken && actionToken) {
2249
2251
  token = actionToken;
2250
- }
2251
- if (useRefreshToken) {
2252
- token = await localStorage2.getRefreshToken();
2253
- } else if (!useRefreshToken && !useActionToken) {
2254
- token = await localStorage2.getAccessToken();
2252
+ } else {
2253
+ const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
2254
+ token = await getToken?.();
2255
2255
  }
2256
2256
  if (token) {
2257
2257
  config2.headers["Authorization"] = `Bearer ${token}`;
@@ -2279,17 +2279,17 @@ var axiosClient = {
2279
2279
  paramsSerializer: (params) => new URLSearchParams(params).toString()
2280
2280
  });
2281
2281
  instance.interceptors.request.use(async (config2) => {
2282
- const { useRefreshToken, useActionToken, actionToken } = config2;
2282
+ const useRefreshToken = config2.headers["X-Use-Refresh-Token"] === "true";
2283
+ const useActionToken = config2.headers["X-Use-Action-Token"] === "true";
2284
+ const actionToken = config2.headers["X-Action-Token"];
2283
2285
  console.log("config", config2);
2284
2286
  console.log("useRefreshToken", useRefreshToken);
2285
2287
  let token = null;
2286
2288
  if (useActionToken && actionToken) {
2287
2289
  token = actionToken;
2288
- }
2289
- if (useRefreshToken) {
2290
- token = await localStorage2.getRefreshToken();
2291
- } else if (!useRefreshToken && !useActionToken) {
2292
- token = await localStorage2.getAccessToken();
2290
+ } else {
2291
+ const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
2292
+ token = await getToken?.();
2293
2293
  }
2294
2294
  if (token) {
2295
2295
  config2.headers["Authorization"] = `Bearer ${token}`;
@@ -2241,17 +2241,17 @@ var axiosClient = {
2241
2241
  paramsSerializer: (params) => new URLSearchParams(params).toString()
2242
2242
  });
2243
2243
  instance.interceptors.request.use(async (config2) => {
2244
- const { useRefreshToken, useActionToken, actionToken } = config2;
2244
+ const useRefreshToken = config2.headers["X-Use-Refresh-Token"] === "true";
2245
+ const useActionToken = config2.headers["X-Use-Action-Token"] === "true";
2246
+ const actionToken = config2.headers["X-Action-Token"];
2245
2247
  console.log("config", config2);
2246
2248
  console.log("useRefreshToken", useRefreshToken);
2247
2249
  let token = null;
2248
2250
  if (useActionToken && actionToken) {
2249
2251
  token = actionToken;
2250
- }
2251
- if (useRefreshToken) {
2252
- token = await localStorage2.getRefreshToken();
2253
- } else if (!useRefreshToken && !useActionToken) {
2254
- token = await localStorage2.getAccessToken();
2252
+ } else {
2253
+ const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
2254
+ token = await getToken?.();
2255
2255
  }
2256
2256
  if (token) {
2257
2257
  config2.headers["Authorization"] = `Bearer ${token}`;
package/dist/hooks.js CHANGED
@@ -3334,10 +3334,10 @@ function useAuthService() {
3334
3334
  const bodyData = {};
3335
3335
  return env?.requests?.post("/action-token/validate" /* VALIDATE_ACTION_TOKEN */, bodyData, {
3336
3336
  headers: {
3337
- "Content-Type": "application/json"
3338
- },
3339
- useActionToken: true,
3340
- actionToken
3337
+ "Content-Type": "application/json",
3338
+ "X-Use-Action-Token": "true",
3339
+ "X-Action-Token": actionToken
3340
+ }
3341
3341
  });
3342
3342
  },
3343
3343
  [env]
@@ -3393,10 +3393,10 @@ function useAuthService() {
3393
3393
  {},
3394
3394
  {
3395
3395
  headers: {
3396
- "Content-Type": "application/json"
3396
+ "Content-Type": "application/json",
3397
+ "X-Use-Refresh-Token": "true"
3397
3398
  },
3398
- withCredentials: true,
3399
- useRefreshToken: true
3399
+ withCredentials: true
3400
3400
  },
3401
3401
  service
3402
3402
  );
package/dist/hooks.mjs CHANGED
@@ -3195,10 +3195,10 @@ function useAuthService() {
3195
3195
  const bodyData = {};
3196
3196
  return env?.requests?.post("/action-token/validate" /* VALIDATE_ACTION_TOKEN */, bodyData, {
3197
3197
  headers: {
3198
- "Content-Type": "application/json"
3199
- },
3200
- useActionToken: true,
3201
- actionToken
3198
+ "Content-Type": "application/json",
3199
+ "X-Use-Action-Token": "true",
3200
+ "X-Action-Token": actionToken
3201
+ }
3202
3202
  });
3203
3203
  },
3204
3204
  [env]
@@ -3254,10 +3254,10 @@ function useAuthService() {
3254
3254
  {},
3255
3255
  {
3256
3256
  headers: {
3257
- "Content-Type": "application/json"
3257
+ "Content-Type": "application/json",
3258
+ "X-Use-Refresh-Token": "true"
3258
3259
  },
3259
- withCredentials: true,
3260
- useRefreshToken: true
3260
+ withCredentials: true
3261
3261
  },
3262
3262
  service
3263
3263
  );
package/dist/provider.js CHANGED
@@ -3324,10 +3324,10 @@ function useAuthService() {
3324
3324
  const bodyData = {};
3325
3325
  return env?.requests?.post("/action-token/validate" /* VALIDATE_ACTION_TOKEN */, bodyData, {
3326
3326
  headers: {
3327
- "Content-Type": "application/json"
3328
- },
3329
- useActionToken: true,
3330
- actionToken
3327
+ "Content-Type": "application/json",
3328
+ "X-Use-Action-Token": "true",
3329
+ "X-Action-Token": actionToken
3330
+ }
3331
3331
  });
3332
3332
  },
3333
3333
  [env]
@@ -3383,10 +3383,10 @@ function useAuthService() {
3383
3383
  {},
3384
3384
  {
3385
3385
  headers: {
3386
- "Content-Type": "application/json"
3386
+ "Content-Type": "application/json",
3387
+ "X-Use-Refresh-Token": "true"
3387
3388
  },
3388
- withCredentials: true,
3389
- useRefreshToken: true
3389
+ withCredentials: true
3390
3390
  },
3391
3391
  service
3392
3392
  );
@@ -5869,17 +5869,17 @@ var axiosClient = {
5869
5869
  paramsSerializer: (params) => new URLSearchParams(params).toString()
5870
5870
  });
5871
5871
  instance.interceptors.request.use(async (config2) => {
5872
- const { useRefreshToken, useActionToken, actionToken } = config2;
5872
+ const useRefreshToken = config2.headers["X-Use-Refresh-Token"] === "true";
5873
+ const useActionToken = config2.headers["X-Use-Action-Token"] === "true";
5874
+ const actionToken = config2.headers["X-Action-Token"];
5873
5875
  console.log("config", config2);
5874
5876
  console.log("useRefreshToken", useRefreshToken);
5875
5877
  let token = null;
5876
5878
  if (useActionToken && actionToken) {
5877
5879
  token = actionToken;
5878
- }
5879
- if (useRefreshToken) {
5880
- token = await localStorage2.getRefreshToken();
5881
- } else if (!useRefreshToken && !useActionToken) {
5882
- token = await localStorage2.getAccessToken();
5880
+ } else {
5881
+ const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
5882
+ token = await getToken?.();
5883
5883
  }
5884
5884
  if (token) {
5885
5885
  config2.headers["Authorization"] = `Bearer ${token}`;
package/dist/provider.mjs CHANGED
@@ -3281,10 +3281,10 @@ function useAuthService() {
3281
3281
  const bodyData = {};
3282
3282
  return env?.requests?.post("/action-token/validate" /* VALIDATE_ACTION_TOKEN */, bodyData, {
3283
3283
  headers: {
3284
- "Content-Type": "application/json"
3285
- },
3286
- useActionToken: true,
3287
- actionToken
3284
+ "Content-Type": "application/json",
3285
+ "X-Use-Action-Token": "true",
3286
+ "X-Action-Token": actionToken
3287
+ }
3288
3288
  });
3289
3289
  },
3290
3290
  [env]
@@ -3340,10 +3340,10 @@ function useAuthService() {
3340
3340
  {},
3341
3341
  {
3342
3342
  headers: {
3343
- "Content-Type": "application/json"
3343
+ "Content-Type": "application/json",
3344
+ "X-Use-Refresh-Token": "true"
3344
3345
  },
3345
- withCredentials: true,
3346
- useRefreshToken: true
3346
+ withCredentials: true
3347
3347
  },
3348
3348
  service
3349
3349
  );
@@ -5826,17 +5826,17 @@ var axiosClient = {
5826
5826
  paramsSerializer: (params) => new URLSearchParams(params).toString()
5827
5827
  });
5828
5828
  instance.interceptors.request.use(async (config2) => {
5829
- const { useRefreshToken, useActionToken, actionToken } = config2;
5829
+ const useRefreshToken = config2.headers["X-Use-Refresh-Token"] === "true";
5830
+ const useActionToken = config2.headers["X-Use-Action-Token"] === "true";
5831
+ const actionToken = config2.headers["X-Action-Token"];
5830
5832
  console.log("config", config2);
5831
5833
  console.log("useRefreshToken", useRefreshToken);
5832
5834
  let token = null;
5833
5835
  if (useActionToken && actionToken) {
5834
5836
  token = actionToken;
5835
- }
5836
- if (useRefreshToken) {
5837
- token = await localStorage2.getRefreshToken();
5838
- } else if (!useRefreshToken && !useActionToken) {
5839
- token = await localStorage2.getAccessToken();
5837
+ } else {
5838
+ const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
5839
+ token = await getToken?.();
5840
5840
  }
5841
5841
  if (token) {
5842
5842
  config2.headers["Authorization"] = `Bearer ${token}`;
package/dist/services.js CHANGED
@@ -3523,10 +3523,10 @@ function useAuthService() {
3523
3523
  const bodyData = {};
3524
3524
  return env?.requests?.post("/action-token/validate" /* VALIDATE_ACTION_TOKEN */, bodyData, {
3525
3525
  headers: {
3526
- "Content-Type": "application/json"
3527
- },
3528
- useActionToken: true,
3529
- actionToken
3526
+ "Content-Type": "application/json",
3527
+ "X-Use-Action-Token": "true",
3528
+ "X-Action-Token": actionToken
3529
+ }
3530
3530
  });
3531
3531
  },
3532
3532
  [env]
@@ -3582,10 +3582,10 @@ function useAuthService() {
3582
3582
  {},
3583
3583
  {
3584
3584
  headers: {
3585
- "Content-Type": "application/json"
3585
+ "Content-Type": "application/json",
3586
+ "X-Use-Refresh-Token": "true"
3586
3587
  },
3587
- withCredentials: true,
3588
- useRefreshToken: true
3588
+ withCredentials: true
3589
3589
  },
3590
3590
  service
3591
3591
  );
package/dist/services.mjs CHANGED
@@ -3478,10 +3478,10 @@ function useAuthService() {
3478
3478
  const bodyData = {};
3479
3479
  return env?.requests?.post("/action-token/validate" /* VALIDATE_ACTION_TOKEN */, bodyData, {
3480
3480
  headers: {
3481
- "Content-Type": "application/json"
3482
- },
3483
- useActionToken: true,
3484
- actionToken
3481
+ "Content-Type": "application/json",
3482
+ "X-Use-Action-Token": "true",
3483
+ "X-Action-Token": actionToken
3484
+ }
3485
3485
  });
3486
3486
  },
3487
3487
  [env]
@@ -3537,10 +3537,10 @@ function useAuthService() {
3537
3537
  {},
3538
3538
  {
3539
3539
  headers: {
3540
- "Content-Type": "application/json"
3540
+ "Content-Type": "application/json",
3541
+ "X-Use-Refresh-Token": "true"
3541
3542
  },
3542
- withCredentials: true,
3543
- useRefreshToken: true
3543
+ withCredentials: true
3544
3544
  },
3545
3545
  service
3546
3546
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fctc/interface-logic",
3
- "version": "3.6.7",
3
+ "version": "3.6.8",
4
4
  "types": "dist/index.d.ts",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",