@fctc/interface-logic 3.6.7 → 3.6.9

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
@@ -3218,11 +3218,16 @@ function useAuthService() {
3218
3218
  }).filter(([_, value]) => !!value)
3219
3219
  );
3220
3220
  const encodedData = new URLSearchParams(payload).toString();
3221
- return env?.requests?.post(body.path, encodedData, {
3222
- headers: {
3223
- "Content-Type": "application/x-www-form-urlencoded"
3224
- }
3225
- });
3221
+ return env?.requests?.post(
3222
+ body.path,
3223
+ encodedData,
3224
+ {
3225
+ headers: {
3226
+ "Content-Type": "application/x-www-form-urlencoded"
3227
+ }
3228
+ },
3229
+ "id"
3230
+ );
3226
3231
  },
3227
3232
  [env]
3228
3233
  );
@@ -3334,10 +3339,10 @@ function useAuthService() {
3334
3339
  const bodyData = {};
3335
3340
  return env?.requests?.post("/action-token/validate" /* VALIDATE_ACTION_TOKEN */, bodyData, {
3336
3341
  headers: {
3337
- "Content-Type": "application/json"
3338
- },
3339
- useActionToken: true,
3340
- actionToken
3342
+ "Content-Type": "application/json",
3343
+ "X-Use-Action-Token": "true",
3344
+ "X-Action-Token": actionToken
3345
+ }
3341
3346
  });
3342
3347
  },
3343
3348
  [env]
@@ -3393,10 +3398,10 @@ function useAuthService() {
3393
3398
  {},
3394
3399
  {
3395
3400
  headers: {
3396
- "Content-Type": "application/json"
3401
+ "Content-Type": "application/json",
3402
+ "X-Use-Refresh-Token": "true"
3397
3403
  },
3398
- withCredentials: true,
3399
- useRefreshToken: true
3404
+ withCredentials: true
3400
3405
  },
3401
3406
  service
3402
3407
  );
package/dist/hooks.mjs CHANGED
@@ -3079,11 +3079,16 @@ function useAuthService() {
3079
3079
  }).filter(([_, value]) => !!value)
3080
3080
  );
3081
3081
  const encodedData = new URLSearchParams(payload).toString();
3082
- return env?.requests?.post(body.path, encodedData, {
3083
- headers: {
3084
- "Content-Type": "application/x-www-form-urlencoded"
3085
- }
3086
- });
3082
+ return env?.requests?.post(
3083
+ body.path,
3084
+ encodedData,
3085
+ {
3086
+ headers: {
3087
+ "Content-Type": "application/x-www-form-urlencoded"
3088
+ }
3089
+ },
3090
+ "id"
3091
+ );
3087
3092
  },
3088
3093
  [env]
3089
3094
  );
@@ -3195,10 +3200,10 @@ function useAuthService() {
3195
3200
  const bodyData = {};
3196
3201
  return env?.requests?.post("/action-token/validate" /* VALIDATE_ACTION_TOKEN */, bodyData, {
3197
3202
  headers: {
3198
- "Content-Type": "application/json"
3199
- },
3200
- useActionToken: true,
3201
- actionToken
3203
+ "Content-Type": "application/json",
3204
+ "X-Use-Action-Token": "true",
3205
+ "X-Action-Token": actionToken
3206
+ }
3202
3207
  });
3203
3208
  },
3204
3209
  [env]
@@ -3254,10 +3259,10 @@ function useAuthService() {
3254
3259
  {},
3255
3260
  {
3256
3261
  headers: {
3257
- "Content-Type": "application/json"
3262
+ "Content-Type": "application/json",
3263
+ "X-Use-Refresh-Token": "true"
3258
3264
  },
3259
- withCredentials: true,
3260
- useRefreshToken: true
3265
+ withCredentials: true
3261
3266
  },
3262
3267
  service
3263
3268
  );
package/dist/provider.js CHANGED
@@ -3208,11 +3208,16 @@ function useAuthService() {
3208
3208
  }).filter(([_, value]) => !!value)
3209
3209
  );
3210
3210
  const encodedData = new URLSearchParams(payload).toString();
3211
- return env?.requests?.post(body.path, encodedData, {
3212
- headers: {
3213
- "Content-Type": "application/x-www-form-urlencoded"
3214
- }
3215
- });
3211
+ return env?.requests?.post(
3212
+ body.path,
3213
+ encodedData,
3214
+ {
3215
+ headers: {
3216
+ "Content-Type": "application/x-www-form-urlencoded"
3217
+ }
3218
+ },
3219
+ "id"
3220
+ );
3216
3221
  },
3217
3222
  [env]
3218
3223
  );
@@ -3324,10 +3329,10 @@ function useAuthService() {
3324
3329
  const bodyData = {};
3325
3330
  return env?.requests?.post("/action-token/validate" /* VALIDATE_ACTION_TOKEN */, bodyData, {
3326
3331
  headers: {
3327
- "Content-Type": "application/json"
3328
- },
3329
- useActionToken: true,
3330
- actionToken
3332
+ "Content-Type": "application/json",
3333
+ "X-Use-Action-Token": "true",
3334
+ "X-Action-Token": actionToken
3335
+ }
3331
3336
  });
3332
3337
  },
3333
3338
  [env]
@@ -3383,10 +3388,10 @@ function useAuthService() {
3383
3388
  {},
3384
3389
  {
3385
3390
  headers: {
3386
- "Content-Type": "application/json"
3391
+ "Content-Type": "application/json",
3392
+ "X-Use-Refresh-Token": "true"
3387
3393
  },
3388
- withCredentials: true,
3389
- useRefreshToken: true
3394
+ withCredentials: true
3390
3395
  },
3391
3396
  service
3392
3397
  );
@@ -5869,17 +5874,17 @@ var axiosClient = {
5869
5874
  paramsSerializer: (params) => new URLSearchParams(params).toString()
5870
5875
  });
5871
5876
  instance.interceptors.request.use(async (config2) => {
5872
- const { useRefreshToken, useActionToken, actionToken } = config2;
5877
+ const useRefreshToken = config2.headers["X-Use-Refresh-Token"] === "true";
5878
+ const useActionToken = config2.headers["X-Use-Action-Token"] === "true";
5879
+ const actionToken = config2.headers["X-Action-Token"];
5873
5880
  console.log("config", config2);
5874
5881
  console.log("useRefreshToken", useRefreshToken);
5875
5882
  let token = null;
5876
5883
  if (useActionToken && actionToken) {
5877
5884
  token = actionToken;
5878
- }
5879
- if (useRefreshToken) {
5880
- token = await localStorage2.getRefreshToken();
5881
- } else if (!useRefreshToken && !useActionToken) {
5882
- token = await localStorage2.getAccessToken();
5885
+ } else {
5886
+ const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
5887
+ token = await getToken?.();
5883
5888
  }
5884
5889
  if (token) {
5885
5890
  config2.headers["Authorization"] = `Bearer ${token}`;
package/dist/provider.mjs CHANGED
@@ -3165,11 +3165,16 @@ function useAuthService() {
3165
3165
  }).filter(([_, value]) => !!value)
3166
3166
  );
3167
3167
  const encodedData = new URLSearchParams(payload).toString();
3168
- return env?.requests?.post(body.path, encodedData, {
3169
- headers: {
3170
- "Content-Type": "application/x-www-form-urlencoded"
3171
- }
3172
- });
3168
+ return env?.requests?.post(
3169
+ body.path,
3170
+ encodedData,
3171
+ {
3172
+ headers: {
3173
+ "Content-Type": "application/x-www-form-urlencoded"
3174
+ }
3175
+ },
3176
+ "id"
3177
+ );
3173
3178
  },
3174
3179
  [env]
3175
3180
  );
@@ -3281,10 +3286,10 @@ function useAuthService() {
3281
3286
  const bodyData = {};
3282
3287
  return env?.requests?.post("/action-token/validate" /* VALIDATE_ACTION_TOKEN */, bodyData, {
3283
3288
  headers: {
3284
- "Content-Type": "application/json"
3285
- },
3286
- useActionToken: true,
3287
- actionToken
3289
+ "Content-Type": "application/json",
3290
+ "X-Use-Action-Token": "true",
3291
+ "X-Action-Token": actionToken
3292
+ }
3288
3293
  });
3289
3294
  },
3290
3295
  [env]
@@ -3340,10 +3345,10 @@ function useAuthService() {
3340
3345
  {},
3341
3346
  {
3342
3347
  headers: {
3343
- "Content-Type": "application/json"
3348
+ "Content-Type": "application/json",
3349
+ "X-Use-Refresh-Token": "true"
3344
3350
  },
3345
- withCredentials: true,
3346
- useRefreshToken: true
3351
+ withCredentials: true
3347
3352
  },
3348
3353
  service
3349
3354
  );
@@ -5826,17 +5831,17 @@ var axiosClient = {
5826
5831
  paramsSerializer: (params) => new URLSearchParams(params).toString()
5827
5832
  });
5828
5833
  instance.interceptors.request.use(async (config2) => {
5829
- const { useRefreshToken, useActionToken, actionToken } = config2;
5834
+ const useRefreshToken = config2.headers["X-Use-Refresh-Token"] === "true";
5835
+ const useActionToken = config2.headers["X-Use-Action-Token"] === "true";
5836
+ const actionToken = config2.headers["X-Action-Token"];
5830
5837
  console.log("config", config2);
5831
5838
  console.log("useRefreshToken", useRefreshToken);
5832
5839
  let token = null;
5833
5840
  if (useActionToken && actionToken) {
5834
5841
  token = actionToken;
5835
- }
5836
- if (useRefreshToken) {
5837
- token = await localStorage2.getRefreshToken();
5838
- } else if (!useRefreshToken && !useActionToken) {
5839
- token = await localStorage2.getAccessToken();
5842
+ } else {
5843
+ const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
5844
+ token = await getToken?.();
5840
5845
  }
5841
5846
  if (token) {
5842
5847
  config2.headers["Authorization"] = `Bearer ${token}`;
package/dist/services.js CHANGED
@@ -3407,11 +3407,16 @@ function useAuthService() {
3407
3407
  }).filter(([_, value]) => !!value)
3408
3408
  );
3409
3409
  const encodedData = new URLSearchParams(payload).toString();
3410
- return env?.requests?.post(body.path, encodedData, {
3411
- headers: {
3412
- "Content-Type": "application/x-www-form-urlencoded"
3413
- }
3414
- });
3410
+ return env?.requests?.post(
3411
+ body.path,
3412
+ encodedData,
3413
+ {
3414
+ headers: {
3415
+ "Content-Type": "application/x-www-form-urlencoded"
3416
+ }
3417
+ },
3418
+ "id"
3419
+ );
3415
3420
  },
3416
3421
  [env]
3417
3422
  );
@@ -3523,10 +3528,10 @@ function useAuthService() {
3523
3528
  const bodyData = {};
3524
3529
  return env?.requests?.post("/action-token/validate" /* VALIDATE_ACTION_TOKEN */, bodyData, {
3525
3530
  headers: {
3526
- "Content-Type": "application/json"
3527
- },
3528
- useActionToken: true,
3529
- actionToken
3531
+ "Content-Type": "application/json",
3532
+ "X-Use-Action-Token": "true",
3533
+ "X-Action-Token": actionToken
3534
+ }
3530
3535
  });
3531
3536
  },
3532
3537
  [env]
@@ -3582,10 +3587,10 @@ function useAuthService() {
3582
3587
  {},
3583
3588
  {
3584
3589
  headers: {
3585
- "Content-Type": "application/json"
3590
+ "Content-Type": "application/json",
3591
+ "X-Use-Refresh-Token": "true"
3586
3592
  },
3587
- withCredentials: true,
3588
- useRefreshToken: true
3593
+ withCredentials: true
3589
3594
  },
3590
3595
  service
3591
3596
  );
package/dist/services.mjs CHANGED
@@ -3362,11 +3362,16 @@ function useAuthService() {
3362
3362
  }).filter(([_, value]) => !!value)
3363
3363
  );
3364
3364
  const encodedData = new URLSearchParams(payload).toString();
3365
- return env?.requests?.post(body.path, encodedData, {
3366
- headers: {
3367
- "Content-Type": "application/x-www-form-urlencoded"
3368
- }
3369
- });
3365
+ return env?.requests?.post(
3366
+ body.path,
3367
+ encodedData,
3368
+ {
3369
+ headers: {
3370
+ "Content-Type": "application/x-www-form-urlencoded"
3371
+ }
3372
+ },
3373
+ "id"
3374
+ );
3370
3375
  },
3371
3376
  [env]
3372
3377
  );
@@ -3478,10 +3483,10 @@ function useAuthService() {
3478
3483
  const bodyData = {};
3479
3484
  return env?.requests?.post("/action-token/validate" /* VALIDATE_ACTION_TOKEN */, bodyData, {
3480
3485
  headers: {
3481
- "Content-Type": "application/json"
3482
- },
3483
- useActionToken: true,
3484
- actionToken
3486
+ "Content-Type": "application/json",
3487
+ "X-Use-Action-Token": "true",
3488
+ "X-Action-Token": actionToken
3489
+ }
3485
3490
  });
3486
3491
  },
3487
3492
  [env]
@@ -3537,10 +3542,10 @@ function useAuthService() {
3537
3542
  {},
3538
3543
  {
3539
3544
  headers: {
3540
- "Content-Type": "application/json"
3545
+ "Content-Type": "application/json",
3546
+ "X-Use-Refresh-Token": "true"
3541
3547
  },
3542
- withCredentials: true,
3543
- useRefreshToken: true
3548
+ withCredentials: true
3544
3549
  },
3545
3550
  service
3546
3551
  );
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.9",
4
4
  "types": "dist/index.d.ts",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",