@arex95/vue-core 1.1.35 → 1.1.37

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,45 +1,25 @@
1
- import { AxiosInstance } from 'axios';
2
- /**
3
- * AxiosService class encapsulates the Axios configuration and logic.
4
- * It manages request and response interceptors and provides methods for making HTTP requests.
5
- */
1
+ import { AxiosInstance } from "axios";
2
+ import { AxiosServiceOptions } from "@/types/AxiosServiceOptions";
3
+ declare module "axios" {
4
+ interface InternalAxiosRequestConfig {
5
+ _retry?: boolean;
6
+ }
7
+ }
6
8
  export declare class AxiosService {
7
9
  private readonly instance;
8
10
  private cancelTokenSource;
9
11
  private activeRequests;
10
- private refreshTokenInProgress;
11
12
  private readonly refreshTokenUrl;
12
- /**
13
- * Initializes the AxiosService instance by creating an Axios instance with default configuration
14
- * and setting up request and response interceptors.
15
- */
16
- constructor(url: string, headers?: Record<string, string>);
17
- /**
18
- * Initializes request and response interceptors for the Axios instance.
19
- */
13
+ private readonly refreshAuth;
14
+ private isRefreshing;
15
+ private failedQueue;
16
+ constructor(options: AxiosServiceOptions, refreshAuth: () => Promise<void>);
17
+ private processQueue;
18
+ private setAuthHeader;
20
19
  private initializeInterceptors;
21
- /**
22
- * Returns the number of active requests.
23
- */
24
20
  getActiveRequests(): number;
25
- /**
26
- * Returns the Axios instance with the configured settings and interceptors.
27
- * @returns {AxiosInstance} The configured Axios instance.
28
- */
29
21
  getAxiosInstance(): AxiosInstance;
30
- /**
31
- * Cancels all ongoing requests.
32
- */
33
22
  cancelAllRequests(): void;
34
- /**
35
- * Sets a new header for the Axios instance.
36
- * @param {string} key - The header key.
37
- * @param {string} value - The header value.
38
- */
39
23
  setHeader(key: string, value: string): void;
40
- /**
41
- * Removes a header from the Axios instance.
42
- * @param {string} key - The header key to remove.
43
- */
44
24
  removeHeader(key: string): void;
45
25
  }
@@ -1,41 +1,12 @@
1
1
  import { AxiosInstance } from "axios";
2
- /**
3
- * Configuration object for the Axios instance.
4
- */
5
2
  interface AxiosConfig {
6
3
  baseURL: string;
7
4
  }
8
- /**
9
- * Configuration object for a custom Axios instance.
10
- */
11
5
  interface CustomAxiosConfig {
12
6
  baseURL: string;
13
7
  headers?: Record<string, string>;
14
8
  }
15
- /**
16
- * Configures the global Axios instance with a base URL.
17
- *
18
- * @param {AxiosConfig} config - An object containing the base URL for the Axios instance.
19
- * @param {string} config.baseURL - The base URL for the Axios instance.
20
- *
21
- * @returns {void}
22
- */
23
9
  export declare const configAxios: (config: AxiosConfig) => void;
24
- /**
25
- * Retrieves the configured Axios instance.
26
- *
27
- * @returns {AxiosService} The configured Axios instance.
28
- * @throws Will throw an error if the Axios instance is not configured.
29
- */
30
10
  export declare const getAxiosInstance: () => AxiosInstance;
31
- /**
32
- * Creates a new AxiosService instance with custom headers.
33
- *
34
- * @param {CustomAxiosConfig} config - An object containing the base URL and optional custom headers.
35
- * @param {string} config.baseURL - The base URL for the Axios instance.
36
- * @param {Record<string, string>} [config.headers] - Custom headers to set (optional).
37
- *
38
- * @returns {AxiosService} The new AxiosService instance.
39
- */
40
11
  export declare const createCustomAxiosInstance: (config: CustomAxiosConfig) => AxiosInstance;
41
12
  export {};