@eka-care/ekascribe-ts-sdk 1.4.37 → 1.4.38

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.
@@ -15,6 +15,7 @@ const PROD = {
15
15
  let envVar = PROD;
16
16
  let client_id = 'doc-web';
17
17
  let auth;
18
+ console.log(envVar, 'envVar in fetch client helper');
18
19
  const setEnv = ({ env, clientId, auth_token, }) => {
19
20
  if (env) {
20
21
  envVar = env === 'PROD' ? PROD : DEV;
@@ -1,15 +1,14 @@
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: NodeJS.Timeout | null = null;
6
- console.log('fetchWrapper - SDK', timeoutMs);
4
+ const controller = new AbortController();
5
+ let timeoutId = null;
7
6
  try {
8
7
  // Set up timeout
9
- // timeoutId = setTimeout(() => {
10
- // console.log('request aborted due to timeout');
11
- // controller.abort();
12
- // }, timeoutMs);
8
+ timeoutId = setTimeout(() => {
9
+ console.log('request aborted due to timeout');
10
+ controller.abort();
11
+ }, timeoutMs);
13
12
  const newHeaders = new Headers(options.headers);
14
13
  if (!newHeaders.get('client-id')) {
15
14
  newHeaders.set('client-id', GET_CLIENT_ID());
@@ -20,7 +19,7 @@ export default async function fetchWrapper(url, options = {}, timeoutMs = API_TI
20
19
  const response = await fetch(url, {
21
20
  ...options,
22
21
  headers: newHeaders,
23
- // signal: controller.signal,
22
+ signal: controller.signal,
24
23
  credentials: 'include',
25
24
  });
26
25
  console.log(response, response.status, 'response in fetch wrapper - SDK');
@@ -34,9 +33,9 @@ export default async function fetchWrapper(url, options = {}, timeoutMs = API_TI
34
33
  throw error;
35
34
  }
36
35
  finally {
37
- // if (timeoutId) {
38
- // clearTimeout(timeoutId);
39
- // timeoutId = null;
40
- // }
36
+ if (timeoutId) {
37
+ clearTimeout(timeoutId);
38
+ timeoutId = null;
39
+ }
41
40
  }
42
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eka-care/ekascribe-ts-sdk",
3
- "version": "1.4.37",
3
+ "version": "1.4.38",
4
4
  "main": "dist/index.js",
5
5
  "repository": "git@github.com:eka-care/eka-js-sdk.git",
6
6
  "author": "Sanikagoyal28 <sanikagoyal9@gmail.com>",