@trackunit/react-core-contexts 0.4.433 → 0.4.436

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/index.cjs.js CHANGED
@@ -102,12 +102,16 @@ const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManage
102
102
  };
103
103
  }));
104
104
  const errorLink = error.onError((errorResponse) => {
105
- var _a, _b;
105
+ var _a, _b, _c, _d;
106
106
  const traceIds = []; // Used to hold id's for use in Sentry
107
107
  if (errorResponse.graphQLErrors) {
108
+ const code = (_b = (_a = errorResponse.graphQLErrors[0]) === null || _a === void 0 ? void 0 : _a.extensions) === null || _b === void 0 ? void 0 : _b.code;
109
+ if (code === "FORCE_RELOAD_BROWSER") {
110
+ window.location.reload();
111
+ }
108
112
  // eslint-disable-next-line no-console
109
113
  console.error(`Error calling: '${errorResponse.operation.getContext().clientAwareness.name}' fetching Data for: ${errorResponse.operation.operationName}`, errorResponse.graphQLErrors);
110
- (_a = errorResponse.graphQLErrors) === null || _a === void 0 ? void 0 : _a.forEach(error => {
114
+ (_c = errorResponse.graphQLErrors) === null || _c === void 0 ? void 0 : _c.forEach(error => {
111
115
  var _a, _b;
112
116
  if (error === null || error === void 0 ? void 0 : error.extensions) {
113
117
  error.extensions.traceId = (_b = (_a = errorResponse.response) === null || _a === void 0 ? void 0 : _a.extensions) === null || _b === void 0 ? void 0 : _b.traceId;
@@ -132,7 +136,7 @@ const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManage
132
136
  },
133
137
  });
134
138
  }
135
- const invalidToken = (_b = errorResponse.graphQLErrors) === null || _b === void 0 ? void 0 : _b.some(x => {
139
+ const invalidToken = (_d = errorResponse.graphQLErrors) === null || _d === void 0 ? void 0 : _d.some(x => {
136
140
  var _a, _b, _c;
137
141
  return (((_a = x === null || x === void 0 ? void 0 : x.extensions) === null || _a === void 0 ? void 0 : _a.code) === "UNAUTHENTICATED" ||
138
142
  ((_b = x === null || x === void 0 ? void 0 : x.message) === null || _b === void 0 ? void 0 : _b.includes("Invalid token specified")) ||
package/index.esm.js CHANGED
@@ -78,12 +78,16 @@ const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManage
78
78
  };
79
79
  }));
80
80
  const errorLink = onError((errorResponse) => {
81
- var _a, _b;
81
+ var _a, _b, _c, _d;
82
82
  const traceIds = []; // Used to hold id's for use in Sentry
83
83
  if (errorResponse.graphQLErrors) {
84
+ const code = (_b = (_a = errorResponse.graphQLErrors[0]) === null || _a === void 0 ? void 0 : _a.extensions) === null || _b === void 0 ? void 0 : _b.code;
85
+ if (code === "FORCE_RELOAD_BROWSER") {
86
+ window.location.reload();
87
+ }
84
88
  // eslint-disable-next-line no-console
85
89
  console.error(`Error calling: '${errorResponse.operation.getContext().clientAwareness.name}' fetching Data for: ${errorResponse.operation.operationName}`, errorResponse.graphQLErrors);
86
- (_a = errorResponse.graphQLErrors) === null || _a === void 0 ? void 0 : _a.forEach(error => {
90
+ (_c = errorResponse.graphQLErrors) === null || _c === void 0 ? void 0 : _c.forEach(error => {
87
91
  var _a, _b;
88
92
  if (error === null || error === void 0 ? void 0 : error.extensions) {
89
93
  error.extensions.traceId = (_b = (_a = errorResponse.response) === null || _a === void 0 ? void 0 : _a.extensions) === null || _b === void 0 ? void 0 : _b.traceId;
@@ -108,7 +112,7 @@ const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManage
108
112
  },
109
113
  });
110
114
  }
111
- const invalidToken = (_b = errorResponse.graphQLErrors) === null || _b === void 0 ? void 0 : _b.some(x => {
115
+ const invalidToken = (_d = errorResponse.graphQLErrors) === null || _d === void 0 ? void 0 : _d.some(x => {
112
116
  var _a, _b, _c;
113
117
  return (((_a = x === null || x === void 0 ? void 0 : x.extensions) === null || _a === void 0 ? void 0 : _a.code) === "UNAUTHENTICATED" ||
114
118
  ((_b = x === null || x === void 0 ? void 0 : x.message) === null || _b === void 0 ? void 0 : _b.includes("Invalid token specified")) ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-core-contexts",
3
- "version": "0.4.433",
3
+ "version": "0.4.436",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {