Changed the path of the editProfile page

This commit is contained in:
Clayton Wilson 2019-12-03 16:37:04 -05:00
parent a4cce0b75e
commit 5b5e785142
3 changed files with 5 additions and 9 deletions

View File

@ -74,7 +74,7 @@ class App extends Component {
<Route exact path="/home" component={home} /> <Route exact path="/home" component={home} />
<Route exact path="/user" component={user} /> <Route exact path="/user" component={user} />
<Route exact path="/edit" component={editProfile} /> <Route exact path="/user/edit" component={editProfile} />
<Route exact path="/verify" component={verify} /> <Route exact path="/verify" component={verify} />
<Route exact path="/search" component={Search} /> <Route exact path="/search" component={Search} />
<Route exact path="/user/:userhandle" component={otherUser} /> <Route exact path="/user/:userhandle" component={otherUser} />

View File

@ -3,7 +3,6 @@ import { Link } from 'react-router-dom';
import axios from "axios"; import axios from "axios";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
// TODO: Add a read-only '@' in the left side of the handle input // TODO: Add a read-only '@' in the left side of the handle input
// TODO: Add a cancel button, that takes the user back to their profile page
// Material-UI stuff // Material-UI stuff
import Box from "@material-ui/core/Box" import Box from "@material-ui/core/Box"
@ -72,10 +71,8 @@ export class editProfile extends Component {
.catch((err) => { .catch((err) => {
console.error(err); console.error(err);
if (err.response.status === 403) { if (err.response.status === 403) {
alert("You are not logged in"); // This user is not logged in
// TODO: Redirect them, to the profile they are trying to edit this.props.history.push('/');
// If they are on /itsjimmy/edit, they will be redirected to /itsjimmy
this.props.history.push('../');
} }
}); });
} }
@ -126,8 +123,7 @@ export class editProfile extends Component {
this.setState({ this.setState({
loading: false loading: false
}); });
// this.props.history.push('/'); this.props.history.push('/user');
// TODO: Need to redirect user to their profile page
}) })
.catch((err) => { .catch((err) => {
console.log(err); console.log(err);

View File

@ -248,7 +248,7 @@ class user extends Component {
// showing the logged in users profile, instead of retreiving the // showing the logged in users profile, instead of retreiving the
// profile based on the URL entered // profile based on the URL entered
let editButtonMarkup = true ? ( let editButtonMarkup = true ? (
<Link to="/edit"> <Link to="/user/edit">
<Button className={classes.button} variant="outlined" color="primary"> <Button className={classes.button} variant="outlined" color="primary">
Edit Profile Edit Profile
</Button> </Button>