@resourge/react-fetch
Version:
[](LICENSE)
34 lines (33 loc) • 1.08 kB
TypeScript
/**
* react-fetch v1.41.3
*
* Copyright (c) resourge.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
import { type FetchError, type HttpResponseError } from '@resourge/http-service';
export type UseFetchError = HttpResponseError | FetchError | Error | null | any;
export type State<T> = {
data: T;
error: UseFetchError;
isLoading: boolean;
};
export type StateConfig<Result> = {
initialState: Result | (() => Result);
isFetchEffect: boolean;
isFetchEffectWithData: boolean;
request: () => Promise<any>;
};
declare const NotificationService: {
getRequest(id: string): Promise<any> | undefined;
startRequest(id: string, prom: Promise<any>): void;
finishRequest(id: string): void;
subscribe(id: string, request: () => Promise<any>): (notification: () => void) => () => void;
notifyAll(): void;
notifyById(id: string): void;
requestAllAgain(filter?: (id: string) => boolean): void;
};
export default NotificationService;