@be-link/request 1.11.0 → 1.13.0

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.
@@ -0,0 +1,33 @@
1
+ import { AxiosResponse, AxiosError, Method } from 'axios';
2
+ interface IConfig {
3
+ method?: Method;
4
+ data?: any;
5
+ url: string;
6
+ headers?: Record<string, string>;
7
+ params?: Record<string, any>;
8
+ requestInterceptors?: (config: any) => any;
9
+ responseInterceptors?: (response: AxiosResponse) => any;
10
+ catchCallback?: (error: AxiosError) => void;
11
+ timeout?: number;
12
+ }
13
+ interface IApiResponse<T = any> {
14
+ message: string;
15
+ data: T;
16
+ code: number;
17
+ }
18
+ declare class BeLinkRequest {
19
+ private instance;
20
+ private token;
21
+ private loginPath;
22
+ constructor();
23
+ setupTokenListener(tokenKey: string | (() => string)): void;
24
+ setupLoingPath(path: string): void;
25
+ private encryptToken;
26
+ setToken(token: string): void;
27
+ private setupInterceptors;
28
+ private setRequestMethod;
29
+ private setInterceptors;
30
+ request<T = any>(config: IConfig): Promise<IApiResponse<T>>;
31
+ }
32
+ declare const beLinkRequest: BeLinkRequest;
33
+ export default beLinkRequest;
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export { default as callFunction } from './callFunction';
2
2
  export { default as request } from './request';
3
+ export { default as beLinkRequest } from './beLinkRequest';