@ctil/gql 1.1.8 → 1.1.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/index.cjs CHANGED
@@ -4703,7 +4703,7 @@ var CCRequest = class {
4703
4703
  return this.refreshPromise;
4704
4704
  }
4705
4705
  // ===== 请求逻辑 =====
4706
- async request(query2, variables) {
4706
+ async request(query2, variables, _retry = false) {
4707
4707
  let queryStr = typeof query2 === "string" ? query2 : print(query2);
4708
4708
  try {
4709
4709
  if (!/refreshToken/i.test(queryStr)) {
@@ -4746,12 +4746,13 @@ var CCRequest = class {
4746
4746
  } catch (err) {
4747
4747
  const message = err.response?.errors?.[0]?.message ?? err.message;
4748
4748
  const status = err.response?.errors?.[0]?.extensions?.code ?? 500;
4749
- if (status === 401 && !/refreshToken/i.test(queryStr)) {
4749
+ if (status === 401 && !_retry && !/refreshToken/i.test(queryStr)) {
4750
4750
  try {
4751
4751
  await this.refreshToken();
4752
4752
  return this.request(queryStr, variables);
4753
4753
  } catch {
4754
4754
  await this.logoutOnce();
4755
+ throw err;
4755
4756
  }
4756
4757
  }
4757
4758
  const formattedError = {