Commit e626689e by Chaiwith Santaweesuk

update

parent b32b83bb
......@@ -115,7 +115,7 @@ class Home extends Component {
keycardAvg: null,
table: null,
};
looper;
componentDidMount = async () => {
await this.getConfig();
await this.getCurrentUser();
......@@ -124,7 +124,8 @@ class Home extends Component {
componentDidUpdate = async (prevProps, prevState) => {
if (prevState.allDevicesId !== this.state.allDevicesId) {
await this.getFeedData();
// await this.getFeedData();
await this.loopFeedData();
}
};
......@@ -173,6 +174,13 @@ class Home extends Component {
this.setState({ allDevicesId });
};
loopFeedData = async (deviceId,selectedRange,breakdown) => {
console.log("loopFeedData")
clearInterval(this.looper)
await this.getFeedData(deviceId,selectedRange,breakdown);
this.looper = setInterval(await this.getFeedData(deviceId,selectedRange,breakdown) , 60000)
}
getFeedData = async (
deviceId,
selectedRange = {
......@@ -215,6 +223,7 @@ class Home extends Component {
};
try {
console.log("getFeedData")
axios.defaults.headers.common['Authorization'] = `Bearer ${userToken}`;
const response = await axios.post(kairosUrl, q_data);
this.setState({
......@@ -266,7 +275,8 @@ class Home extends Component {
};
getSelectedFeed = ({ device, range, breakdown }) => {
this.getFeedData(device, range, breakdown);
this.loopFeedData(device, range, breakdown);
// this.getFeedData(device, range, breakdown);
};
getMax = data => {
......
......@@ -18,7 +18,7 @@ export default class Mapbox extends React.PureComponent {
state = {
center: undefined,
active: undefined,
zoom: [15],
zoom: [10],
data:[]
};
......@@ -71,7 +71,7 @@ export default class Mapbox extends React.PureComponent {
onClick={() =>
this.setState({
center: this.state.data[item].position,
zoom: [15],
zoom: [10],
active: this.state.data[item],
})
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment