Skip to content
Snippets Groups Projects

improve front

Merged Antoine Gaudron-Desjardins requested to merge collab_front into main
3 files
+ 16
29
Compare changes
  • Side-by-side
  • Inline

Files

+ 12
26
@@ -11,33 +11,19 @@ import {
} from "recharts";
import "../styles/Graph.css";
export default function DailyGraph({ place }) {
const [day, min_time_hour, min_time_mn, max_time_hour, max_time_mn, interval] = [
3, 12, 0, 12, 40, 300,
];
const url =
process.env.REACT_APP_BASE_URL_BACK +
"/" +
place +
"/stats/" +
day +
"/" +
min_time_hour +
"/" +
min_time_mn +
"/" +
max_time_hour +
"/" +
max_time_mn +
"/" +
interval;
const [data, setData] = React.useState([]);
export default function Graph({ place, type }) {
const [data, setData] = React.useState(null);
React.useEffect(() => {
axios.get(url).then((response) => {
setData(response.data);
});
}, [url]);
axios
.get(
`${process.env.REACT_APP_BASE_URL_BACK}/${encodeURIComponent(place)}/${encodeURIComponent(
type,
)}_graph`,
)
.then((response) => {
setData(response.data);
});
}, []);
if (!data) return null;
const CustomTooltip = ({ active, payload }) => {
Loading