mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2026-03-10 21:25:04 +00:00
Merge branch 'master' into profile_display
This commit is contained in:
56
twistter-frontend/src/pages/Delete.js
Normal file
56
twistter-frontend/src/pages/Delete.js
Normal file
@@ -0,0 +1,56 @@
|
||||
/* eslint-disable */
|
||||
import React, { Component } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
// Material UI stuff
|
||||
import Button from "@material-ui/core/Button";
|
||||
import withStyles from "@material-ui/core/styles/withStyles";
|
||||
|
||||
// Redux stuff
|
||||
import { logoutUser } from "../redux/actions/userActions";
|
||||
import { connect } from "react-redux";
|
||||
|
||||
const styles = {
|
||||
form: {
|
||||
textAlign: "center"
|
||||
},
|
||||
textField: {
|
||||
marginBottom: 30
|
||||
},
|
||||
pageTitle: {
|
||||
marginBottom: 40
|
||||
},
|
||||
button: {
|
||||
positon: "relative",
|
||||
marginBottom: 30
|
||||
},
|
||||
progress: {
|
||||
position: "absolute"
|
||||
}
|
||||
};
|
||||
|
||||
export class Delete extends Component {
|
||||
|
||||
componentDidMount() {
|
||||
this.props.logoutUser();
|
||||
this.props.history.push('/');
|
||||
}
|
||||
|
||||
render() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state) => ({
|
||||
user: state.user
|
||||
});
|
||||
|
||||
const mapActionsToProps = { logoutUser };
|
||||
|
||||
Delete.propTypes = {
|
||||
logoutUser: PropTypes.func.isRequired,
|
||||
user: PropTypes.object.isRequired,
|
||||
classes: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapActionsToProps)(withStyles(styles)(Delete));
|
||||
@@ -146,7 +146,7 @@ export class Login extends Component {
|
||||
)}
|
||||
</Button>
|
||||
{errors.general && (
|
||||
<Typography color="error">Wrong Email or Password</Typography>
|
||||
<Typography color="error">Invalid username/email or password</Typography>
|
||||
)}
|
||||
</form>
|
||||
</Grid>
|
||||
|
||||
@@ -159,7 +159,7 @@ export class Signup extends Component {
|
||||
)}
|
||||
</Button>
|
||||
{errors.general && (
|
||||
<Typography color="error">Wrong Email or Password</Typography>
|
||||
<Typography color="error">Invalid username/email or password</Typography>
|
||||
)}
|
||||
</form>
|
||||
</Grid>
|
||||
|
||||
@@ -88,6 +88,14 @@ export class edit extends Component {
|
||||
handle: this.state.handle,
|
||||
bio: this.state.bio
|
||||
};
|
||||
|
||||
// Removes all keys from newProfileData that are empty, undefined, or null
|
||||
Object.keys(newProfileData).forEach(key => {
|
||||
if (newProfileData[key] === "" || newProfileData[key] === undefined || newProfileData[key] === null) {
|
||||
delete newProfileData[key];
|
||||
}
|
||||
})
|
||||
|
||||
axios
|
||||
.post("/updateProfileInfo", newProfileData)
|
||||
.then((res) => {
|
||||
|
||||
Reference in New Issue
Block a user