Commit 3454e080 by Chaiwith Santaweesuk

update

parent 2890f86a
...@@ -134,24 +134,28 @@ class Home extends Component { ...@@ -134,24 +134,28 @@ class Home extends Component {
getAllDevicesInfo = async () => { getAllDevicesInfo = async () => {
const { currentUid } = this.state; const { currentUid } = this.state;
console.log("currentUid")
console.log(currentUid)
const DevicesId = await db const DevicesId = await db
.collection('membership') .collection('membership')
.doc(currentUid) .doc(currentUid)
.get(); .get();
// console.log(Object.keys(DevicesId.data())); console.log(Object.keys(DevicesId.data()));
// const allDevicesId = Object.keys(DevicesId.data()); const allDevicesId = Object.keys(DevicesId.data());
// console.log(allDevicesId); // console.log(allDevicesId);
// let allDeviceInfo = []; let allDeviceInfo = [];
// allDevicesId.map(async (deviceId, index) => { for (let i = 0, len = allDevicesId.length; i < len; i++) {
// const deviceInfo = await db const deviceInfo = await db
// .collection('device') .collection('device')
// .doc(deviceId) .doc(allDevicesId[i])
// .get(); .get();
allDeviceInfo.push(deviceInfo.data());
// allDeviceInfo.push(deviceInfo.data()); if(i==allDevicesId.length-1){
// }); console.log(allDeviceInfo)
this.setState({ allDevicesId: Object.keys(DevicesId.data()) }); }
}
// this.setState({ allDevicesId: Object.keys(DevicesId.data()) });
}; };
getFeedData = async (deviceId, selectedRange, breakdown) => { getFeedData = async (deviceId, selectedRange, breakdown) => {
......
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