Created
June 7, 2018 15:00
-
-
Save jmrboosties/e3a541366ea5843928feebc1f9dc678c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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