@eka-care/ekascribe-ts-sdk 1.5.23 → 1.5.25

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.
@@ -24,17 +24,20 @@ export default async function fetchWrapper(url, options = {}, timeoutMs = API_TI
24
24
  signal: controller.signal,
25
25
  credentials: 'include',
26
26
  });
27
- if (onEventCallback) {
28
- onEventCallback({
29
- callback_type: CALLBACK_TYPE.AUTHENTICATION_STATUS,
30
- status: 'success',
31
- message: 'Fetch wrapper response: ' + response.status,
32
- timestamp: new Date().toISOString(),
33
- data: {
34
- request: 'Request body: ' + JSON.stringify(options.body),
35
- response: 'Response body: ' + JSON.stringify(response),
36
- },
37
- });
27
+ if (!response.ok) {
28
+ if (onEventCallback) {
29
+ onEventCallback({
30
+ callback_type: CALLBACK_TYPE.AUTHENTICATION_STATUS,
31
+ status: 'error',
32
+ message: 'Fetch wrapper response: ' + response.ok + response.status,
33
+ timestamp: new Date().toISOString(),
34
+ data: {
35
+ request: 'Request body: ' + JSON.stringify(options.body),
36
+ response: 'Response body: ' + JSON.stringify(response),
37
+ },
38
+ });
39
+ }
40
+ throw new Error('Fetch wrapper error: ' + response.ok + response.status);
38
41
  }
39
42
  return response;
40
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eka-care/ekascribe-ts-sdk",
3
- "version": "1.5.23",
3
+ "version": "1.5.25",
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>",