function saveDiet(dietPlan, dietPlanID) {
  // Add a new message entry to the database.

  loadDiets()

  return firebase
    .firestore()
    .collection("diet")
    .doc(dietPlanID)
    .set({
      email: getUserEmail(),
      diet: dietPlan,
      timestamp: firebase.firestore.FieldValue.serverTimestamp(),
    })
    .catch(function (error) {
      console.error("Error writing new message to database", error);
    });
}
// Saves a new message on the Firebase DB.
Saves a new message on the Firebase DB.
Saves a new message on the Firebase DB .
function saveDiet(dietPlan, dietPlanID) {
  loadDiets()
  return firebase
    .firestore()
    .collection("diet")
    .doc(dietPlanID)
    .set({
      email: getUserEmail(),
      diet: dietPlan,
      timestamp: firebase.firestore.FieldValue.serverTimestamp(),
    })
    .catch(function (error) {
      console.error("Error writing new message to database", error);
    });
}
function saveDiet ( dietPlan , dietPlanID ) { loadDiets ( ) return firebase . firestore ( ) . collection ( "diet" ) . doc ( dietPlanID ) . set ( { email : getUserEmail ( ) , diet : dietPlan , timestamp : firebase . firestore . FieldValue . serverTimestamp ( ) , } ) . catch ( function ( error ) { console . error ( "Error writing new message to database" , error ) ; } ) ; }
Saves a new message on the Firebase DB.
Saves a new message on the Firebase DB .
// Add a new message entry to the database.