Fix History component and rebuild client with History page navigation
This commit is contained in:
1 parent
69e321d35f
commit
c7ebc5aff3
6 files changed
+9
-116
No files matched your search
@@ -2,9 +2,6 @@ import React, { useState, useEffect } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import axios from 'axios';
|
||||
import {
|
||||
LineChart,
|
||||
Line,
|
||||
AreaChart,
|
||||
Area,
|
||||
XAxis,
|
||||
YAxis,
|
||||
@@ -22,10 +19,6 @@ function History() {
|
||||
const [days, setDays] = useState(7);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
loadHistory();
|
||||
}, [days]);
|
||||
|
||||
const loadHistory = async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
@@ -38,6 +31,11 @@ function History() {
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
loadHistory();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [days]);
|
||||
|
||||
if (loading) return <div className="container">Loading history...</div>;
|
||||
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user