{this.props.profile.userImg ? (
@@ -77,7 +87,7 @@ class UserProfile extends React.Component {
{this.props.profile.occupation}
{this.props.profile.interests ? (
-
+
) : (
''
)}
@@ -115,6 +125,7 @@ const styles = {
root: {
height: '100%',
width: '100%',
+ marginTop: '3rem',
},
};
diff --git a/src/reducers/accountReducer.js b/src/reducers/accountReducer.js
index def6ce2..372d8ea 100644
--- a/src/reducers/accountReducer.js
+++ b/src/reducers/accountReducer.js
@@ -17,6 +17,7 @@ export const accountReducer = (state = initialState, action) => {
case UPDATING_ACCOUNT_INFO:
return { ...state, updatingAccountInfo: true };
case ACCOUNT_INFORMATION_UPDATED:
+ action.payload.account.id = state.account.id;
return {
...state,
updatingAccountInfo: false,
diff --git a/src/views/Login.js b/src/views/Login.js
index 9b406c8..78a7c6e 100644
--- a/src/views/Login.js
+++ b/src/views/Login.js
@@ -32,7 +32,6 @@ class Login extends Component {
if (this.props.authenticated) {
return
;
}
- const { classes } = this.props;
return (
{
+ let id = props.match.params.id;
+ let profileType = props.match.params.accountType;
let profileOwner = false;
let accountType = 'user';
- if (this.props.account.hasOwnProperty('companyName')) {
+ if (props.account.hasOwnProperty('companyName')) {
accountType = 'company';
}
- if (
- parseInt(id) === this.props.account.id &&
- profileType === accountType
- ) {
+ if (parseInt(id) === props.account.id && profileType === accountType) {
profileOwner = true;
}
@@ -35,19 +35,19 @@ class Profile extends Component {
if (profileType === 'job') {
url = `/jobs/${id}`;
} else if (profileType === 'company') {
- url = `/company/${id}`;
+ url = `/companies/${id}`;
}
if (profileType === 'user' && profileOwner) {
url = `/users/info`;
}
- requestWithToken(this.props.token)
+ requestWithToken(props.token)
.get(url)
.then(res => {
- //debugger;
+ debugger;
if (accountType === 'company' && profileType === 'job') {
- if (res.data.company_id === this.props.account.id) {
+ if (res.data.company_id === props.account.id) {
profileOwner = true;
}
}
@@ -58,13 +58,22 @@ class Profile extends Component {
});
})
.catch(err => {
- //debugger;
console.log(err.message);
});
+ };
+
+ componentWillUpdate(nextProps, nextState, nextContext) {
+ if (
+ nextProps.match.params.id !== this.props.match.params.id ||
+ nextProps.match.params.accountType !==
+ this.props.match.params.accountType
+ ) {
+ this.getProfile(nextProps);
+ return true;
+ }
}
render() {
- //debugger;
const { classes } = this.props;
return (