@nano-lib/util 1.1.6 → 1.1.7

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.
@@ -40,13 +40,12 @@ export interface PendingRequest {
40
40
  resolve: (value: any) => void;
41
41
  reject: (reason?: any) => void;
42
42
  }
43
- export interface ToastInstanceType<T = AnyObj> {
44
- show(message: string, type: 'success' | 'warning' | 'info' | 'error', options: T): void;
45
- success(message: string, options?: T): void;
46
- error(message: string, options?: T): void;
47
- warning(message: string, options?: T): void;
48
- info(message: string, options?: T): void;
49
- confirm(message: string, title: string, options: T): Promise<boolean>;
43
+ export interface ToastInstanceType<T extends string = string, U extends AnyObj = AnyObj> {
44
+ show(message: string, type: T, options: U): void;
45
+ success(message: string, options?: U): void;
46
+ error(message: string, options?: U): void;
47
+ warning(message: string, options?: U): void;
48
+ info(message: string, options?: U): void;
50
49
  clear(): void;
51
50
  }
52
51
  export interface LoadingOptions {
@@ -61,8 +60,8 @@ export interface LoadingInstanceType {
61
60
  forceHide(): void;
62
61
  isLoading(): boolean;
63
62
  }
64
- export interface RequestConstructorOptions extends RequestConfig {
65
- toastInstance: ToastInstanceType;
63
+ export interface RequestConstructorOptions<T extends string, U extends AnyObj> extends RequestConfig {
64
+ toastInstance: ToastInstanceType<T, U>;
66
65
  loadingInstance?: LoadingInstanceType;
67
66
  }
68
67
  export interface BaseResponse<T = any> {
@@ -1,6 +1,7 @@
1
1
  import { AxiosRequestConfig } from 'axios';
2
+ import { AnyObj } from '../../types';
2
3
  import { RequestConstructorOptions, RequestOptions, RequestParams } from '../../types/request';
3
- export default class Request {
4
+ export default class Request<ToastType extends string = string, ToastOptions extends AnyObj = AnyObj> {
4
5
  private axiosInstance;
5
6
  private errorInstance;
6
7
  private networkInstance;
@@ -11,7 +12,7 @@ export default class Request {
11
12
  private requestInstanceRequestOptions;
12
13
  private defaultRequestOptions;
13
14
  private defaultConfig;
14
- constructor(options: RequestConstructorOptions);
15
+ constructor(options: RequestConstructorOptions<ToastType, ToastOptions>);
15
16
  private setupNetworkListener;
16
17
  private setupInterceptors;
17
18
  private refreshTokenInBackend;
@@ -1,5 +1,5 @@
1
1
  import { NetworkStatus, PendingRequest, ToastInstanceType } from '../../types/request';
2
- export default class NetworkManager {
2
+ export default class NetworkManage {
3
3
  private toastInstance;
4
4
  private status;
5
5
  private offlineQueue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nano-lib/util",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "description": "Custom utility functions for the nano library",
5
5
  "author": "xylo",
6
6
  "license": "MIT",