fix: broken loading screen
This commit is contained in:
@@ -37,6 +37,7 @@ const StatPage = () => {
|
|||||||
|
|
||||||
const getStats = () => {
|
const getStats = () => {
|
||||||
setError("");
|
setError("");
|
||||||
|
setLoading(true);
|
||||||
|
|
||||||
Promise.all([
|
Promise.all([
|
||||||
axios.get("http://localhost:5000/stats/time"),
|
axios.get("http://localhost:5000/stats/time"),
|
||||||
@@ -78,7 +79,8 @@ const StatPage = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
})
|
})
|
||||||
.catch((e) => setError("Failed to load statistics: " + String(e)));
|
.catch((e) => setError("Failed to load statistics: " + String(e)))
|
||||||
|
.finally(() => setLoading(false));
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSearch = () => {
|
const onSearch = () => {
|
||||||
@@ -105,9 +107,7 @@ const StatPage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setLoading(true);
|
|
||||||
getStats();
|
getStats();
|
||||||
setLoading(false);
|
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
if (loading) return <p className="p-6">Loading insights…</p>;
|
if (loading) return <p className="p-6">Loading insights…</p>;
|
||||||
|
|||||||
Reference in New Issue
Block a user