Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmrboosties/e3a541366ea5843928feebc1f9dc678c to your computer and use it in GitHub Desktop.
Save jmrboosties/e3a541366ea5843928feebc1f9dc678c to your computer and use it in GitHub Desktop.
exports.submitEntry = functions.https.onCall((data, context) => {
console.log('hey welcome to the party');
console.dir(data);
if(data.password != 'password') {
console.log('bad password');
return{
errors: ['bad password']
};
}
else {
delete data.password;
let exercises = db.collection('exercises');
exercisesRef.add(data)
.then(ref => {
return ref.get();
}).then(doc => {
let responseData = doc.data();
responseData.id = doc.id;
return responseData;
})
.catch(function(error) {
return error;
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment