interface IRequestCreateConfig {
  baseURL?: string;
  token?: () => string;
}

interface IRequestConfig<R, T> {
  url: string;
  method: 'GET' | 'POST';
  header?: Record<string, string>;
  data?: string | Record<string, any> | ArrayBuffer;
  params?: Record<string, any>;
  timeout?: number;
  meta?: { ignoreToken: boolean };
  shareRequest?: boolean;
  transform?: ({ data, header }: { data: T, header: Record<string, string> }) => R;
}

type IRequestData<T> = {
  code: number;
  msg: string;
  total?: number;
  rows?: any[];
  data: T;
  success?: boolean;
  warn?: boolean;
  error?: boolean;
};

interface IUploadConfig<R, T> {
  url?: string;
  header?: Record<string, string>;
  data?: Record<string, any>;
  params: {
    file: string;
    name: string;
  };
  timeout?: number;
  meta?: { ignoreToken: boolean };
  transform?: ({ data, header }: { data: T, header: Record<string, string> }) => R;
}