@casipe/react-service-provider
Version:
React library sevice provider
25 lines (24 loc) • 991 B
TypeScript
import { AxiosRequestConfig } from 'axios';
import { Observable } from 'rxjs';
import { ServiceProviderProps, ServiceResponseData } from './interfaces';
import { RequestConfig } from './serviceLayer';
export interface IService {
[k: string]: unknown;
baseURL?: string;
}
export declare class Service<P extends IService = any> {
params: P | IService;
private injections;
requestConfig: RequestConfig;
private responsePipe;
constructor(params: P | IService, injections: Omit<ServiceProviderProps, 'services'>);
getConfig(config: string): any;
getProp(prop: string): any;
private getTenant;
private getCountry;
private getAcceptLanguage;
private getCreatedOwner;
defaultAxiosRequestConfig(config: AxiosRequestConfig): AxiosRequestConfig;
request<T = any>(axiosRequestConfig: AxiosRequestConfig): Observable<ServiceResponseData<T>>;
requestAsync<T = any>(axiosRequestConfig: AxiosRequestConfig): Promise<ServiceResponseData<T>>;
}