UNPKG

@casipe/react-service-provider

Version:
43 lines (42 loc) 1.09 kB
import React from 'react'; import { Service } from './Service'; import { SocketService } from './SocketService'; import { AxiosRequestConfig } from 'axios'; import { Registry } from './serviceLayer'; export interface ServiceProviderValue { services: Service[]; socketServices: SocketService[]; } export interface ServiceProviderProps { children: React.ReactNode; config: { baseURL: string; [key: string]: any; }; services?: typeof Service[]; socketServices?: typeof SocketService[]; [prop: string]: any; } export interface ServiceInterface<C = any> { config: C; } export interface ServiceQueueRegistry { request: AxiosRequestConfig; } export type ServiceQueue = ServiceQueueRegistry[]; export interface ServiceResponseData<T = any> { isLoading: boolean; headers?: any; data?: T; error?: Error; isCached?: boolean; registry?: Registry; status?: number; } export interface SocketServiceResponseData<T = any> { isLoading: boolean; data?: T; error?: Error; status?: number; success?: boolean; }