-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathAnalysisContainer.jsx
More file actions
40 lines (36 loc) · 1.08 KB
/
AnalysisContainer.jsx
File metadata and controls
40 lines (36 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import React, { useState, useEffect } from 'react';
import RequestService from '../../util/RequestService';
import AuthContext from '../../AuthContext';
import './AnalysisContainer.css';
import AnalysisGraph from './components/AnalysisGraph';
const AnalysisContainer = () => {
const [loading, setLoading] = useState(false);
const [graphData, setGraphData] = useState([]);
useEffect(() => {
setLoading(true);
RequestService.getGraphDataByColors(
response => {
console.log(response.data.data);
setGraphData(response.data.data);
setLoading(false);
},
error => console.error('Error loading graph data: ' + error),
);
//setGraphData(sampleGraphData);
setLoading(false);
}, []);
return (
<AuthContext.Consumer>
{context => {
return (
<div className="analysisContainer">
<div className="flexbox">
<AnalysisGraph loading={loading} graphData={graphData} />
</div>
</div>
);
}}
</AuthContext.Consumer>
);
};
export default AnalysisContainer;