fix(request-hook): increase priority for handle...

configuration. Now `onComplete` callback in handle config
overwrite `onComplete` callback in hook config.

Closes #10
This commit is contained in:
Dmitriy Pleshevskiy 2020-11-06 01:02:16 +03:00
parent 55bb4fe795
commit 7e8bc3d557

View file

@ -78,7 +78,7 @@ export function useLazyRequest<R = Record<string, any>, V = Record<string, any>,
return Promise.resolve(state.data);
}
const onComplete = config?.onComplete ?? handlerConfig?.onComplete;
const onComplete = handlerConfig?.onComplete ?? config?.onComplete;
const onFailure = handlerConfig?.onFailure ?? config?.onFailure;
dispatch({ type: 'call', headers, variables, params });