@hapl/api-queries 0.2.20 → 0.2.21

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.
@@ -1,15 +1,11 @@
1
1
  import { AxiosResponse, AxiosError } from 'axios';
2
- declare type SuccessData = {
3
- success: true;
4
- data: undefined;
5
- };
6
2
  declare type ErrorData = {
7
3
  success: false;
8
4
  data: {
9
5
  error: string;
10
6
  };
11
7
  };
12
- declare type ResultData = SuccessData['data'];
8
+ declare type ResultData = null;
13
9
  declare type ResultError = ErrorData['data']['error'];
14
10
  export declare type CreateCianRatingHeaders = {
15
11
  'x-auth-hc': string;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.2.20",
2
+ "version": "0.2.21",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -1,9 +1,9 @@
1
1
  import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
2
 
3
- type SuccessData = { success: true; data: undefined };
3
+ type SuccessData = '';
4
4
  type ErrorData = { success: false; data: { error: string } };
5
5
 
6
- type ResultData = SuccessData['data'];
6
+ type ResultData = null;
7
7
  type ResultError = ErrorData['data']['error'];
8
8
 
9
9
  export type CreateCianRatingHeaders = { 'x-auth-hc': string };
@@ -24,7 +24,7 @@ export function createCianRatingRequest({
24
24
  headers: { Accept: 'application/json', 'Content-Type': 'application/json', ...headers },
25
25
  transformResponse: [
26
26
  ...(axios.defaults.transformResponse as AxiosTransformer[]),
27
- (data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? undefined : data.data.error),
27
+ (data: SuccessData | ErrorData): ResultData | ResultError => (data === '' ? null : data.data.error),
28
28
  ],
29
29
  })
30
30
  .then((res: CreateCianRatingData) => res)