mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2025-12-16 02:08:47 +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) {
|
firebase.auth().onAuthStateChanged(function(user) {
|
||||||
currentUser = user;
|
currentUser = user;
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
/*db.collection("users").doc(`${currentUser.handle}`).delete()
|
db.collection("users").doc(`${req.user.handle}`).delete()
|
||||||
.then(function() {
|
.then(function() {
|
||||||
res.status(200).send("Removed user from database.");
|
res.status(200).send("Removed user from database.");
|
||||||
return;
|
return;
|
||||||
})
|
})
|
||||||
.catch(function(err) {
|
.catch(function(err) {
|
||||||
res.status(500).send("Failed to remove user from database.", 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()
|
currentUser.delete()
|
||||||
.then(function() {
|
.then(function() {
|
||||||
|
|||||||
@ -29,7 +29,7 @@ app.post("/signup", signup);
|
|||||||
app.post("/login", login);
|
app.post("/login", login);
|
||||||
|
|
||||||
//Deletes user account
|
//Deletes user account
|
||||||
app.delete("/delete", deleteUser);
|
app.delete("/delete", fbAuth, deleteUser);
|
||||||
|
|
||||||
app.get("/getUser/:handle", getUserDetails);
|
app.get("/getUser/:handle", getUserDetails);
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,8 @@ import Button from "@material-ui/core/Button";
|
|||||||
import withStyles from "@material-ui/core/styles/withStyles";
|
import withStyles from "@material-ui/core/styles/withStyles";
|
||||||
|
|
||||||
// Redux stuff
|
// 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";
|
import { connect } from "react-redux";
|
||||||
|
|
||||||
const styles = {
|
const styles = {
|
||||||
@ -32,7 +33,8 @@ const styles = {
|
|||||||
export class Delete extends Component {
|
export class Delete extends Component {
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.props.logoutUser();
|
//this.props.logoutUser();
|
||||||
|
this.props.deleteUser();
|
||||||
this.props.history.push('/');
|
this.props.history.push('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,10 +47,12 @@ const mapStateToProps = (state) => ({
|
|||||||
user: state.user
|
user: state.user
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapActionsToProps = { logoutUser };
|
//const mapActionsToProps = { logoutUser };
|
||||||
|
const mapActionsToProps = { deleteUser };
|
||||||
|
|
||||||
Delete.propTypes = {
|
Delete.propTypes = {
|
||||||
logoutUser: PropTypes.func.isRequired,
|
//logoutUser: PropTypes.func.isRequired,
|
||||||
|
deleteUser: PropTypes.func.isRequired,
|
||||||
user: PropTypes.object.isRequired,
|
user: PropTypes.object.isRequired,
|
||||||
classes: PropTypes.object.isRequired
|
classes: PropTypes.object.isRequired
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user