changed putPost function to see postID

This commit is contained in:
shobhitm23 2019-10-31 15:46:40 -04:00
parent 51fc965a90
commit b45fc3640c

View File

@ -18,10 +18,15 @@ exports.putPost = (req, res) => {
}; };
const resPost;
admin.firestore().collection('posts').add(newPost) admin.firestore().collection('posts').add(newPost)
.then((doc) => { .then((doc) => {
const resPost = newPost; resPost = newPost;
resPost.postId = doc.id; resPost.postId = doc.id;
return admin.firestore().doc(`posts/${doc.id}`).set(resPost)
})
.then(() => {
return res.status(200).json(resPost); return res.status(200).json(resPost);
}) })
.catch((err) => { .catch((err) => {