From 7e8bc3d5572438b44548be24b0e59123c5a4f227 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Fri, 6 Nov 2020 01:02:16 +0300 Subject: [PATCH] fix(request-hook): increase priority for handle... configuration. Now `onComplete` callback in handle config overwrite `onComplete` callback in hook config. Closes #10 --- src/lazy-request-hook.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lazy-request-hook.ts b/src/lazy-request-hook.ts index 4bb95c9..dadd674 100644 --- a/src/lazy-request-hook.ts +++ b/src/lazy-request-hook.ts @@ -78,7 +78,7 @@ export function useLazyRequest, V = Record, 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 });