import type { Schema, NetworkError, EndpointInterface, UnknownError, FetchFunction, } from '@rest-hooks/react'; import { useError as useErrorNew } from '@rest-hooks/react'; import { useMemo } from 'react'; import shapeToEndpoint from '../endpoint/adapter.js'; import { ReadShape, ParamsFromShape } from '../endpoint/index.js'; export type ErrorTypes = NetworkError | UnknownError; type UseErrorReturn
= P extends [null] ? undefined : ErrorTypes | undefined;
/**
* Get any errors for a given request
* @see https://resthooks.io/docs/api/useError
*/
export default function useError<
E extends
| Pick<
EndpointInterface