import { useCallback } from 'react' ; import { Identifier } from '../types' ; import useMutation , { MutationOptions , Mutation } from './useMutation' ; param resource param ids param options returns example example const useDeleteMany = ( resource ? , ids ? , options ? ) : UseDeleteManyHookValue => { const [ mutate , state ] = useMutation ( { type : 'deleteMany' , resource , payload : { ids } } , options ) ; const deleteMany = useCallback ( ( resource ? , ids ? , options ? ) => { if ( typeof resource === 'string' ) { const query = { type : 'deleteMany' , resource , payload : { ids : ids as Identifier [ ] , } , } ; return mutate ( query , options ) ; } else { return mutate ( resource as Mutation | Event , ids as MutationOptions ) ; } } , [ mutate ] ) ; return [ deleteMany , state ] ; } ; type UseDeleteManyHookValue = [ ( resource ? : string | Partial < Mutation > | Event , ids ? : Identifier [ ] | Partial < MutationOptions > , options ? : MutationOptions ) => void | Promise < any > , { data ? : Identifier [ ] ; total ? : number ; error ? : any ; loading : boolean ; loaded : boolean ; } ] ; export default useDeleteMany ;