Merge branch 'master' into profile_display

This commit is contained in:
Leon Liang
2019-10-24 22:12:02 -04:00
committed by GitHub
17 changed files with 291 additions and 244 deletions

View 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));

View File

@@ -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>

View File

@@ -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>

View File

@@ -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) => {