mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2025-12-15 18:08:46 +00:00
Delete users fully works now
This commit is contained in:
parent
eea2f56b49
commit
fd226b454e
@ -151,18 +151,14 @@ exports.deleteUser = (req, res) => {
|
||||
firebase.auth().onAuthStateChanged(function(user) {
|
||||
currentUser = user;
|
||||
if (currentUser) {
|
||||
/*db.collection("users").doc(`${currentUser.handle}`).delete()
|
||||
db.collection("users").doc(`${req.user.handle}`).delete()
|
||||
.then(function() {
|
||||
res.status(200).send("Removed user from database.");
|
||||
return;
|
||||
})
|
||||
.catch(function(err) {
|
||||
res.status(500).send("Failed to remove user from database.", err);
|
||||
});*/
|
||||
|
||||
//let ref = db.collection('users');
|
||||
//let userDoc = ref.where('userId', '==', currentUser.uid).get();
|
||||
//userDoc.ref.delete();
|
||||
});
|
||||
|
||||
currentUser.delete()
|
||||
.then(function() {
|
||||
|
||||
@ -29,7 +29,7 @@ app.post("/signup", signup);
|
||||
app.post("/login", login);
|
||||
|
||||
//Deletes user account
|
||||
app.delete("/delete", deleteUser);
|
||||
app.delete("/delete", fbAuth, deleteUser);
|
||||
|
||||
app.get("/getUser/:handle", getUserDetails);
|
||||
|
||||
|
||||
@ -7,7 +7,8 @@ import Button from "@material-ui/core/Button";
|
||||
import withStyles from "@material-ui/core/styles/withStyles";
|
||||
|
||||
// Redux stuff
|
||||
import { logoutUser } from "../redux/actions/userActions";
|
||||
//import { logoutUser } from "../redux/actions/userActions";
|
||||
import { deleteUser } from "../redux/actions/userActions";
|
||||
import { connect } from "react-redux";
|
||||
|
||||
const styles = {
|
||||
@ -32,7 +33,8 @@ const styles = {
|
||||
export class Delete extends Component {
|
||||
|
||||
componentDidMount() {
|
||||
this.props.logoutUser();
|
||||
//this.props.logoutUser();
|
||||
this.props.deleteUser();
|
||||
this.props.history.push('/');
|
||||
}
|
||||
|
||||
@ -45,10 +47,12 @@ const mapStateToProps = (state) => ({
|
||||
user: state.user
|
||||
});
|
||||
|
||||
const mapActionsToProps = { logoutUser };
|
||||
//const mapActionsToProps = { logoutUser };
|
||||
const mapActionsToProps = { deleteUser };
|
||||
|
||||
Delete.propTypes = {
|
||||
logoutUser: PropTypes.func.isRequired,
|
||||
//logoutUser: PropTypes.func.isRequired,
|
||||
deleteUser: PropTypes.func.isRequired,
|
||||
user: PropTypes.object.isRequired,
|
||||
classes: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user