ag-common 0.0.402 → 0.0.403
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.
|
@@ -66,17 +66,23 @@ const callOpenApi = (p) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
66
66
|
let data = undefined;
|
|
67
67
|
const config = {
|
|
68
68
|
basePath: apiUrl,
|
|
69
|
-
baseOptions: { headers:
|
|
69
|
+
baseOptions: { headers: headers || {} },
|
|
70
70
|
middleware: [],
|
|
71
71
|
};
|
|
72
|
+
//comes from either id_token cookie OR auth override param
|
|
72
73
|
const idToken = yield getIdTokenAuthHeader(p);
|
|
73
|
-
if (
|
|
74
|
+
if (headers === null || headers === void 0 ? void 0 : headers.authorization) {
|
|
75
|
+
config.baseOptions.headers.authorization = headers.authorization.toString();
|
|
76
|
+
}
|
|
77
|
+
else if ((headers === null || headers === void 0 ? void 0 : headers.authorization) === undefined && idToken) {
|
|
74
78
|
config.baseOptions.headers.authorization = `Bearer ${idToken}`;
|
|
79
|
+
}
|
|
80
|
+
if (config.baseOptions.headers.authorization) {
|
|
75
81
|
config.middleware = [
|
|
76
82
|
{
|
|
77
83
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
78
84
|
pre: (oldFetchParams) => {
|
|
79
|
-
oldFetchParams.init.headers = Object.assign({ authorization:
|
|
85
|
+
oldFetchParams.init.headers = Object.assign({ authorization: config.baseOptions.headers.authorization }, oldFetchParams.init.headers);
|
|
80
86
|
},
|
|
81
87
|
},
|
|
82
88
|
];
|
|
@@ -13,13 +13,9 @@ const getAllCookies = (cookieString) => {
|
|
|
13
13
|
if (!cookieString) {
|
|
14
14
|
return cookieKeyValuePairs;
|
|
15
15
|
}
|
|
16
|
-
// Split the cookie string into an array of strings
|
|
17
16
|
const cookieArr = cookieString.split(';');
|
|
18
|
-
// Loop through the array of strings
|
|
19
17
|
for (let i = 0; i < cookieArr.length; i++) {
|
|
20
|
-
// Split each string into an array of key and value
|
|
21
18
|
const cookieKeyValue = cookieArr[i].split('=');
|
|
22
|
-
// Add the key value pair to the object
|
|
23
19
|
cookieKeyValuePairs[cookieKeyValue[0].trim()] = cookieKeyValue[1].trim();
|
|
24
20
|
}
|
|
25
21
|
return cookieKeyValuePairs;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
export declare const useIsomorphicLayoutEffect: typeof useEffect;
|
|
3
3
|
export default useIsomorphicLayoutEffect;
|
|
4
|
-
export declare function useInterval(callback: () => void,
|
|
4
|
+
export declare function useInterval(callback: () => void,
|
|
5
|
+
/** ms delay */
|
|
6
|
+
delay: number | null,
|
|
5
7
|
/** optionally called on return of useEffect */
|
|
6
8
|
clear?: () => void): void;
|
|
@@ -4,18 +4,16 @@ exports.useInterval = exports.useIsomorphicLayoutEffect = void 0;
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
exports.useIsomorphicLayoutEffect = typeof window !== 'undefined' ? react_1.useLayoutEffect : react_1.useEffect;
|
|
6
6
|
exports.default = exports.useIsomorphicLayoutEffect;
|
|
7
|
-
function useInterval(callback,
|
|
7
|
+
function useInterval(callback,
|
|
8
|
+
/** ms delay */
|
|
9
|
+
delay,
|
|
8
10
|
/** optionally called on return of useEffect */
|
|
9
11
|
clear) {
|
|
10
12
|
const savedCallback = (0, react_1.useRef)(callback);
|
|
11
|
-
// Remember the latest callback if it changes.
|
|
12
13
|
(0, exports.useIsomorphicLayoutEffect)(() => {
|
|
13
14
|
savedCallback.current = callback;
|
|
14
15
|
}, [callback]);
|
|
15
|
-
// Set up the interval.
|
|
16
16
|
(0, react_1.useEffect)(() => {
|
|
17
|
-
// Don't schedule if no delay is specified.
|
|
18
|
-
// Note: 0 is a valid value for delay.
|
|
19
17
|
if (!delay && delay !== 0) {
|
|
20
18
|
return;
|
|
21
19
|
}
|