WIP financial statements.

This commit is contained in:
Ahmed Bouhuolia
2020-03-31 16:30:38 +02:00
parent da05239e84
commit 1bf837ae17
26 changed files with 442 additions and 148 deletions

View File

@@ -9,12 +9,12 @@ const useAsync = (asyncFunction, immediate = true) => {
// handles setting state for pending, value, and error.
// useCallback ensures the below useEffect is not called
// on every render, but only if asyncFunction changes.
const execute = useCallback(() => {
const execute = useCallback((...args) => {
setPending(true);
setValue(null);
setError(null);
return asyncFunction()
return asyncFunction(...args)
.then(response => setValue(response))
.catch(error => setError(error))
.finally(() => setPending(false));