이윤영

Modify HomeTab

......@@ -80,6 +80,29 @@ export default class HomeTab extends Component {
}
};
get_diff_data(){
return fetch('http://10.0.2.2:3000/app/get_diff_data/',{
method:'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body:JSON.stringify({
ras_id : this.state.ID,
date : this.state.today,
}),
})
.then((response) => console.log(response.json()))
.then((responseJson)=> {
console.log(responseJson)
alert(responseJson[0].ras_id.S);
},function(){
})
.catch((error) => {
console.error(error);
})
}
render() {
// const fill = 'rgb(134, 65, 244)'
// const data = [50, 10, 40, 95, -4, -24, null, 85, undefined, 0, 35, 53, -53, 24, 50, -20, -80]
......
......@@ -16,7 +16,8 @@ export default class HomeTab extends Component {
super(props);
this.state = {
ID : this.props.navigation.getParam('id','pi1'),
today : date.getFullYear() + "." + month + "." + date.getDate(),
// today : date.getFullYear() + "." + month + "." + date.getDate(),
today : "1576237044146.4011",
current_weight : get_now_weight() ,
table_contents : [['오후','6:12:15', '+0.25kg', 'Total : 1.5 kg'],['오후','4:27:52', '+0.12kg', 'Total : 1.38kg'],
['오후','6:12:15', '+0.25kg', 'Total : 1.5 kg'],['오후','6:12:15', '+0.25kg', 'Total : 1.5 kg'],
......@@ -36,11 +37,13 @@ export default class HomeTab extends Component {
},
body:JSON.stringify({
ras_id : this.state.ID,
date : this.state.today,
//date : this.state.today,
date : "1576237047226.6567"
}),
})
.then((response) => console.log(response.json()))
.then((responseJson)=> {
//alert(responseJson[0][0].ras_id.S);
console.log(responseJson)
},function(){
})
......
......@@ -54,16 +54,15 @@ export function add_data(responseJson){
}
return responseJson.length;
}
}
export function get_now_weight(){
let wastes = realm.objects('Waste');
let recent = realm.objects('Waste').max('date').date;
let recentWeight = wastes.filtered('date = 1576223063238.5166');
//"id == %@", id!
console.log(String(wastes.lenth));
return recentWeight[0].weight;
// return "3.8"
}
export function get_recent_date(){
......