Commit 3454e080 by Chaiwith Santaweesuk

update

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