diff --git a/src/Context.tsx b/src/Context.tsx index ae1e84d7..0d2ae30e 100644 --- a/src/Context.tsx +++ b/src/Context.tsx @@ -2,7 +2,7 @@ import noop from "lodash/noop"; import * as React from "react"; import { ResolveFunction } from "./Get"; -export interface RestfulReactProviderProps { +export interface RestfulReactProviderProps { /** The backend URL where the RESTful resources live. */ base: string; /** @@ -14,7 +14,7 @@ export interface RestfulReactProviderProps { * A function to resolve data return from the backend, most typically * used when the backend response needs to be adapted in some way. */ - resolve?: ResolveFunction; + resolve?: ResolveFunction; /** * Options passed to the fetch request. */ @@ -26,7 +26,15 @@ export interface RestfulReactProviderProps { * Depending of your case, it can be easier to add a `localErrorOnly` on your `Mutate` component * to deal with your retry locally instead of in the provider scope. */ - onError?: (err: any, retry: () => Promise, response?: Response) => void; + onError?: ( + err: { + message: string; + data: TData | string; + status?: number; + }, + retry: () => Promise, + response?: Response, + ) => void; /** * Any global level query params? * **Warning:** it's probably not a good idea to put API keys here. Consider headers instead.