mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 12:47:13 +01:00
Added error message component. Update fetch hook.
This commit is contained in:
parent
4cafa68e23
commit
ca8a6fe049
8 changed files with 50 additions and 11 deletions
|
|
@ -25,7 +25,13 @@ export default function useFetch(url, params = {}, options = {}) {
|
|||
|
||||
dispatch(updateQuery({ url, time: performance.now() - time, completed: Date.now() }));
|
||||
|
||||
setData(data);
|
||||
if (status >= 400) {
|
||||
setError(data);
|
||||
setData(null);
|
||||
} else {
|
||||
setData(data);
|
||||
}
|
||||
|
||||
setStatus(status);
|
||||
onDataLoad(data);
|
||||
} catch (e) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue