mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2025-12-15 18:08:46 +00:00
Merge branch 'admin-delete' of https://github.com/ClaytonWWilson/CS307-Team24 into admin-delete:x
This commit is contained in:
commit
bae2947003
@ -1,7 +1,7 @@
|
||||
/* eslint-disable prefer-arrow-callback */
|
||||
/* eslint-disable promise/always-return */
|
||||
const admin = require("firebase-admin");
|
||||
const { db } = require("../util/admin");
|
||||
const { admin, db } = require("../util/admin");
|
||||
|
||||
|
||||
exports.putPost = (req, res) => {
|
||||
const newPost = {
|
||||
@ -33,6 +33,18 @@ exports.putPost = (req, res) => {
|
||||
});
|
||||
};
|
||||
|
||||
exports.deletePost = (req, res) => {
|
||||
let posts = db.collection("posts")
|
||||
.where("userHandle", "==", req.user.handle)
|
||||
.get()
|
||||
.then((query) => {
|
||||
query.forEach((snap) => {
|
||||
snap.ref.delete();
|
||||
});
|
||||
return;
|
||||
})
|
||||
};
|
||||
|
||||
exports.getallPostsforUser = (req, res) => {
|
||||
var post_query = admin
|
||||
.firestore()
|
||||
|
||||
@ -62,6 +62,7 @@ class Home extends Component {
|
||||
flagPost = (event) => {
|
||||
// Flags a post
|
||||
let postId = event.target.dataset.key ? event.target.dataset.key : event.target.parentNode.dataset.key;
|
||||
console.log(postId);
|
||||
axios.post(`/hidePost`, {postId})
|
||||
.then((res) => {
|
||||
console.log(res.data);
|
||||
@ -160,6 +161,8 @@ class Home extends Component {
|
||||
|
||||
{/* <button>Quote</button> */}
|
||||
|
||||
<Typography variant="body2" color={"textSecondary"}>Likes {post.likeCount} Comments {post.commentCount}</Typography>
|
||||
|
||||
</CardContent>
|
||||
</Card>
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user