function to send results to plan

This commit is contained in:
Ava DeCroix
2023-05-02 18:03:26 -04:00
parent 8209f6e505
commit e423c9b86f

View File

@@ -175,6 +175,33 @@ const net_id = ReactSession.get("net_id");
});
}
//Send sums to results if it is Saturday
const sendResults = () => {
var day = planDay();
if (day === 7):
Axios.post('http://3.219.93.142:8000/api/results',
{
net_id: ReactSession.get("net_id"),
week_date: weekStart(),
total_cal: Number(sum.total_cal),
total_fat: Number(sum.total_fat),
total_sat_fat: Number(sum.total_sat_fat),
total_trans_fat: Number(sum.total_trans_fat),
total_carbs: Number(sum.total_carbs),
total_fiber: Number(sum.total_fiber),
total_sugar: Number(sum.total_sugar),
total_protein: Number(sum.total_protein),
total_sodium: Number(sum.total_sodium),
total_potassium: Number(sum.total_potassium),
total_cholesterol: Number(sum.total_cholesterol),}
).then((response) => {
console.log(response);
});
}
//Set color variables for chips
const [cals, setCals] = useState(false);