This commit is contained in:
Arnaud Vergnet 2021-05-13 10:32:44 +02:00
джерело 6516cf918d
коміт 50c62dd676

@ -78,10 +78,10 @@ export function useRequestLogic<T>(
} }
if (canRefresh) { if (canRefresh) {
if (!response.loading) { if (!response.loading) {
setResponse({ setResponse((prevState) => ({
...response, ...prevState,
loading: true, loading: true,
}); }));
} }
const r = newRequest ? newRequest : request; const r = newRequest ? newRequest : request;
r() r()
@ -98,13 +98,13 @@ export function useRequestLogic<T>(
} }
}) })
.catch(() => { .catch(() => {
setResponse({ setResponse((prevState) => ({
loading: false, loading: false,
lastRefreshDate: response.lastRefreshDate, lastRefreshDate: prevState.lastRefreshDate,
status: REQUEST_STATUS.CONNECTION_ERROR, status: REQUEST_STATUS.CONNECTION_ERROR,
code: undefined, code: undefined,
data: response.data, data: prevState.data,
}); }));
}); });
} }
}; };