Types
createApis
/**
* @arg {string} path Request URL path
* @arg {*} payload Request payload. Omit if method is GET.
* @arg {object} options Axios options
*
* @returns {Promise<AxiosResponse>}
*/
interface makeRequest {
(path: string, ...rest: any[]): Promise<AxiosResponse>;
}
interface AxiosWrapperInstance {
get: makeRequest;
put: makeRequest;
patch: makeRequest;
post: makeRequest;
delete: makeRequest;
addAuthorization: {
(authorization: string): void;
};
removeAuthorization: {
(): void;
};
addHeader: {
(name: string, value: string): void;
};
removeHeader: {
(name: string): void;
};
instance: AxiosInstance;
}
/**
* @arg {string} path URL Path
* @arg {any} payload Request payload. Skip if GET.
* @arg {function} success Success action
* @arg {function} fail Fail action
* @arg {function} done? Done action
*/
interface makeCall {
(path: string, ...rest: any[]): Promise<AxiosResponse>;
}
interface SagaApiInstance {
get: makeCall;
post: makeCall;
put: makeCall;
patch: makeCall;
delete: makeCall;
}
/**
* @param {AxiosRequestConfig} options Axios configuration
*/
declare const createApis: (options: AxiosRequestConfig) => {
api: AxiosWrapperInstance;
sagaApi: SagaApiInstance;
};refetch
crudSaga
crudInitialState
crudReducers
crudSlice
Last updated
Was this helpful?