@trackunit/react-core-contexts 1.5.7 → 1.7.0
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 +2 -5
- package/index.esm.js +3 -6
- package/package.json +8 -8
package/index.cjs.js
CHANGED
|
@@ -96,9 +96,7 @@ const createApolloClient = ({ graphqlPublicUrl, graphqlInternalUrl, graphqlRepor
|
|
|
96
96
|
},
|
|
97
97
|
});
|
|
98
98
|
const invalidToken = graphQLErrors.some(x => {
|
|
99
|
-
return (
|
|
100
|
-
// saw it not unnecessary
|
|
101
|
-
x.extensions?.code === "UNAUTHENTICATED" ||
|
|
99
|
+
return (x.extensions?.code === "UNAUTHENTICATED" ||
|
|
102
100
|
x.message.includes("Invalid token specified") ||
|
|
103
101
|
x.message.includes("Access denied! You need to be authorized to perform this action!"));
|
|
104
102
|
});
|
|
@@ -215,11 +213,10 @@ const useApolloClient = () => {
|
|
|
215
213
|
errorHandler,
|
|
216
214
|
});
|
|
217
215
|
});
|
|
218
|
-
react.
|
|
216
|
+
react.useEffect(() => {
|
|
219
217
|
if (client.getToken() !== currentToken) {
|
|
220
218
|
client.setToken(currentToken);
|
|
221
219
|
}
|
|
222
|
-
return currentToken;
|
|
223
220
|
}, [client, currentToken]);
|
|
224
221
|
return client;
|
|
225
222
|
};
|
package/index.esm.js
CHANGED
|
@@ -7,7 +7,7 @@ import { getMainDefinition, Observable } from '@apollo/client/utilities';
|
|
|
7
7
|
import { useEnvironment, useToken, useErrorHandler, AnalyticsContextProvider, AssetSortingProvider, ConfirmationDialogProvider, EnvironmentContextProvider, ErrorHandlingContextProvider, FilterBarProvider, ModalDialogContextProvider, NavigationContextProvider, OemBrandingContextProvider, TimeRangeProvider, ToastProvider, TokenProvider, CurrentUserProvider, CurrentUserPreferenceProvider, UserSubscriptionProvider, WidgetConfigProvider } from '@trackunit/react-core-hooks';
|
|
8
8
|
import { print } from 'graphql';
|
|
9
9
|
import { createClient } from 'graphql-sse';
|
|
10
|
-
import { useState,
|
|
10
|
+
import { useState, useEffect, useMemo, Suspense } from 'react';
|
|
11
11
|
import '@js-temporal/polyfill';
|
|
12
12
|
import { registerTranslations, initializeTranslationsForApp } from '@trackunit/i18n-library-translation';
|
|
13
13
|
import { Spinner } from '@trackunit/react-components';
|
|
@@ -94,9 +94,7 @@ const createApolloClient = ({ graphqlPublicUrl, graphqlInternalUrl, graphqlRepor
|
|
|
94
94
|
},
|
|
95
95
|
});
|
|
96
96
|
const invalidToken = graphQLErrors.some(x => {
|
|
97
|
-
return (
|
|
98
|
-
// saw it not unnecessary
|
|
99
|
-
x.extensions?.code === "UNAUTHENTICATED" ||
|
|
97
|
+
return (x.extensions?.code === "UNAUTHENTICATED" ||
|
|
100
98
|
x.message.includes("Invalid token specified") ||
|
|
101
99
|
x.message.includes("Access denied! You need to be authorized to perform this action!"));
|
|
102
100
|
});
|
|
@@ -213,11 +211,10 @@ const useApolloClient = () => {
|
|
|
213
211
|
errorHandler,
|
|
214
212
|
});
|
|
215
213
|
});
|
|
216
|
-
|
|
214
|
+
useEffect(() => {
|
|
217
215
|
if (client.getToken() !== currentToken) {
|
|
218
216
|
client.setToken(currentToken);
|
|
219
217
|
}
|
|
220
|
-
return currentToken;
|
|
221
218
|
}, [client, currentToken]);
|
|
222
219
|
return client;
|
|
223
220
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-core-contexts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -11,15 +11,15 @@
|
|
|
11
11
|
"react": "19.0.0",
|
|
12
12
|
"@js-temporal/polyfill": "^0.4.4",
|
|
13
13
|
"jest-fetch-mock": "^3.0.3",
|
|
14
|
-
"@trackunit/iris-app-api": "1.
|
|
15
|
-
"@trackunit/react-core-contexts-api": "1.
|
|
16
|
-
"@trackunit/react-core-hooks": "1.
|
|
17
|
-
"@trackunit/i18n-library-translation": "1.
|
|
18
|
-
"@trackunit/react-components": "1.
|
|
19
|
-
"@trackunit/iris-app-runtime-core": "1.
|
|
14
|
+
"@trackunit/iris-app-api": "1.6.0",
|
|
15
|
+
"@trackunit/react-core-contexts-api": "1.7.0",
|
|
16
|
+
"@trackunit/react-core-hooks": "1.6.0",
|
|
17
|
+
"@trackunit/i18n-library-translation": "1.6.0",
|
|
18
|
+
"@trackunit/react-components": "1.7.0",
|
|
19
|
+
"@trackunit/iris-app-runtime-core": "1.7.0",
|
|
20
20
|
"graphql": "^16.10.0",
|
|
21
21
|
"graphql-sse": "^2.5.4",
|
|
22
|
-
"@trackunit/react-test-setup": "1.
|
|
22
|
+
"@trackunit/react-test-setup": "1.3.0"
|
|
23
23
|
},
|
|
24
24
|
"module": "./index.esm.js",
|
|
25
25
|
"main": "./index.cjs.js",
|