From 0fb61f3df1d54ea8999165260aa1efd07fbe1e10 Mon Sep 17 00:00:00 2001 From: maker27 <39836924+maker27@users.noreply.github.com> Date: Sun, 10 Apr 2022 23:01:43 +0300 Subject: [PATCH] fix action type in catch block --- src/custom-hooks/components/useApiCallOnMount.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/custom-hooks/components/useApiCallOnMount.js b/src/custom-hooks/components/useApiCallOnMount.js index 0087d14..9ae3713 100644 --- a/src/custom-hooks/components/useApiCallOnMount.js +++ b/src/custom-hooks/components/useApiCallOnMount.js @@ -29,11 +29,11 @@ const useApiCallOnMount = (service) => { dispatch({ type: 'success', data }); }) .catch((error) => { - dispatch({ type: 'success', error }); + dispatch({ type: 'error', error }); }) }, [service]); return [state.loading, state.data, state.error]; }; -export default useApiCallOnMount; \ No newline at end of file +export default useApiCallOnMount;