@eka-care/ekascribe-ts-sdk 1.4.35 → 1.4.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.
|
@@ -10,7 +10,9 @@ export const getConfigV2 = async () => {
|
|
|
10
10
|
},
|
|
11
11
|
};
|
|
12
12
|
const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V2()}/config/`, options);
|
|
13
|
+
console.log(response, 'response in getConfigV2');
|
|
13
14
|
const res = await response.json();
|
|
15
|
+
console.log(res, 'res in getConfigV2');
|
|
14
16
|
return {
|
|
15
17
|
...res,
|
|
16
18
|
code: response.status,
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { GET_CLIENT_ID, GET_AUTH_TOKEN } from './helper';
|
|
2
2
|
const API_TIMEOUT_MS = 10000;
|
|
3
3
|
export default async function fetchWrapper(url, options = {}, timeoutMs = API_TIMEOUT_MS) {
|
|
4
|
-
const controller = new AbortController();
|
|
5
|
-
let timeoutId = null;
|
|
4
|
+
// const controller = new AbortController();
|
|
5
|
+
// let timeoutId: NodeJS.Timeout | null = null;
|
|
6
|
+
console.log('fetchWrapper - SDK', timeoutMs);
|
|
6
7
|
try {
|
|
7
8
|
// Set up timeout
|
|
8
|
-
timeoutId = setTimeout(() => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}, timeoutMs);
|
|
9
|
+
// timeoutId = setTimeout(() => {
|
|
10
|
+
// console.log('request aborted due to timeout');
|
|
11
|
+
// controller.abort();
|
|
12
|
+
// }, timeoutMs);
|
|
12
13
|
const newHeaders = new Headers(options.headers);
|
|
13
14
|
if (!newHeaders.get('client-id')) {
|
|
14
15
|
newHeaders.set('client-id', GET_CLIENT_ID());
|
|
@@ -19,23 +20,23 @@ export default async function fetchWrapper(url, options = {}, timeoutMs = API_TI
|
|
|
19
20
|
const response = await fetch(url, {
|
|
20
21
|
...options,
|
|
21
22
|
headers: newHeaders,
|
|
22
|
-
signal: controller.signal,
|
|
23
|
+
// signal: controller.signal,
|
|
23
24
|
credentials: 'include',
|
|
24
25
|
});
|
|
25
|
-
console.log(response, 'response in fetch wrapper');
|
|
26
|
+
console.log(response, response.status, 'response in fetch wrapper - SDK');
|
|
26
27
|
if (response.status === 401 || response.status === 403) {
|
|
27
|
-
console.log('unauthorized - fetch wrapper ', response.status);
|
|
28
|
+
console.log('unauthorized - fetch wrapper - SDK', response.status);
|
|
28
29
|
}
|
|
29
30
|
return response;
|
|
30
31
|
}
|
|
31
32
|
catch (error) {
|
|
32
|
-
console.error(error, 'error in fetch wrapper');
|
|
33
|
+
console.error(error, 'error in fetch wrapper - SDK');
|
|
33
34
|
throw error;
|
|
34
35
|
}
|
|
35
36
|
finally {
|
|
36
|
-
if (timeoutId) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
37
|
+
// if (timeoutId) {
|
|
38
|
+
// clearTimeout(timeoutId);
|
|
39
|
+
// timeoutId = null;
|
|
40
|
+
// }
|
|
40
41
|
}
|
|
41
42
|
}
|