strapi-custom-auth 1.2.35 → 1.2.36

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.
@@ -70,12 +70,17 @@ const originalFetch = window.fetch;
70
70
  const fetchInterceptor = (storage) => {
71
71
  window.fetch = async (input, init = {}) => {
72
72
  console.log("---input---", JSON.stringify(input));
73
+ console.log("---init---", JSON.stringify(init));
73
74
  const url = input instanceof Request ? input.url : input;
74
75
  console.log("---url---", url);
75
76
  const byPass = init.headers ? await init.headers.get("x-by-pass") : false;
76
77
  if (url.includes("/admin/renew-token") || url.includes("/auth/login") || url.includes("repos/strapi/strapi/releases/latest") || url.includes("/admin/init") || init.body instanceof FormData || byPass == true) {
77
78
  console.log("---skip renewal---");
78
79
  try {
80
+ const _token = storage.getItem("jwtToken").replace(/"/g, "");
81
+ console.log("---skip renewal, _token---", _token);
82
+ init.headers.set("Authorization", `Bearer ${_token}`);
83
+ console.log("---skip renewal, init---", JSON.stringify(init));
79
84
  const response = await originalFetch(input, init);
80
85
  console.log("---response--", JSON.stringify(response));
81
86
  console.log("---response, json--", await response.json());
@@ -69,12 +69,17 @@ const originalFetch = window.fetch;
69
69
  const fetchInterceptor = (storage) => {
70
70
  window.fetch = async (input, init = {}) => {
71
71
  console.log("---input---", JSON.stringify(input));
72
+ console.log("---init---", JSON.stringify(init));
72
73
  const url = input instanceof Request ? input.url : input;
73
74
  console.log("---url---", url);
74
75
  const byPass = init.headers ? await init.headers.get("x-by-pass") : false;
75
76
  if (url.includes("/admin/renew-token") || url.includes("/auth/login") || url.includes("repos/strapi/strapi/releases/latest") || url.includes("/admin/init") || init.body instanceof FormData || byPass == true) {
76
77
  console.log("---skip renewal---");
77
78
  try {
79
+ const _token = storage.getItem("jwtToken").replace(/"/g, "");
80
+ console.log("---skip renewal, _token---", _token);
81
+ init.headers.set("Authorization", `Bearer ${_token}`);
82
+ console.log("---skip renewal, init---", JSON.stringify(init));
78
83
  const response = await originalFetch(input, init);
79
84
  console.log("---response--", JSON.stringify(response));
80
85
  console.log("---response, json--", await response.json());
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.35",
2
+ "version": "1.2.36",
3
3
  "keywords": [],
4
4
  "type": "commonjs",
5
5
  "exports": {