@ewb/reach-react
Version:
React Resource and Fetch stuff
16 lines (15 loc) • 655 B
TypeScript
import { Dispatch, SetStateAction } from 'react';
import { IReachOptions } from '@ewb/reach';
import type { IUseProps } from './types';
export declare type IUseDeleteProps<T> = Pick<IUseProps<T>, 'onDelete' | 'onError'>;
export interface IUseDeleteState<T, E> {
busy: boolean;
data?: T;
error?: E;
}
export declare type IUseDeleteRet<T, E> = [
state: IUseDeleteState<T, E>,
del: (id: string) => Promise<T | null>,
setState: Dispatch<SetStateAction<IUseDeleteState<T, E>>>
];
export declare function useDelete<T, E = any>(path: string, props?: IUseDeleteProps<T>, reachOptions?: Omit<IReachOptions, 'method'>): IUseDeleteRet<T, E>;