@movalib/movalib-commons 1.41.0 → 1.41.1

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,14 +1,10 @@
1
1
  import { APIMethod, MovaAppType } from "./Enums";
2
2
  export declare const API_BASE_URL: string;
3
- type APISuccess<T> = {
4
- success: true;
5
- data: T;
3
+ export type APIResponse<T> = {
4
+ success: boolean;
5
+ data?: T;
6
+ error?: string;
6
7
  };
7
- type APIError = {
8
- success: false;
9
- error: string;
10
- };
11
- export type APIResponse<T> = APISuccess<T> | APIError;
12
8
  export type APIRequest = {
13
9
  url: string;
14
10
  method: APIMethod;
@@ -22,4 +18,3 @@ export type APIRequest = {
22
18
  * @returns
23
19
  */
24
20
  export declare const request: (options: APIRequest) => Promise<APIResponse<any>>;
25
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movalib/movalib-commons",
3
- "version": "1.41.0",
3
+ "version": "1.41.1",
4
4
  "description": "Bibliothèque d'objets communs à l'ensemble des projets React de Movalib",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,8 +13,16 @@ type APIError = {
13
13
  success: false;
14
14
  error: string;
15
15
  };
16
+ // This inference type is not ready yet, we have to be sure
17
+ // that we handle all the backend return cases before changing this
18
+ // export type APIResponse<T> = APISuccess<T> | APIError;
16
19
 
17
- export type APIResponse<T> = APISuccess<T> | APIError;
20
+ export type APIResponse<T> = {
21
+ success: boolean,
22
+ data?: T,
23
+ error?: string
24
+
25
+ }
18
26
 
19
27
  export type APIRequest = {
20
28
  url: string,