Profiles are being created seamlessly
This commit is contained in:
@@ -163,7 +163,7 @@ class Profile extends React.Component {
|
||||
<div className='sidePanel'>
|
||||
<p>Return <Link to='/'>home</Link></p>
|
||||
<PasswordChangePanel />
|
||||
<Logout />
|
||||
<Logout onClick={(e) => this.props.history.push('/')} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -174,7 +174,7 @@ class Profile extends React.Component {
|
||||
<div className='sidePanel'>
|
||||
<p>Return <Link to='/'>home</Link></p>
|
||||
<p>Go to <Link to='/profile' onClick={(e) => { e.preventDefault(); this.requestProfileData(this.props.username); this.props.history.push('/profile'); }}>your profile</Link></p>
|
||||
<Logout />
|
||||
<Logout onClick={(e) => this.props.history.push('/')} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { logout } from '../../actions/accounts.js';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
class Logout extends React.Component {
|
||||
constructor(props) {
|
||||
@@ -26,9 +27,20 @@ class Logout extends React.Component {
|
||||
}));
|
||||
|
||||
this.props.logout();
|
||||
|
||||
if (this.props.onClick) {
|
||||
this.props.onClick();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Logout.propTypes = {
|
||||
email: PropTypes.string.isRequired,
|
||||
token: PropTypes.number.isRequired,
|
||||
logout: PropTypes.func.isRequired,
|
||||
onClick: PropTypes.func
|
||||
}
|
||||
|
||||
function mapStoreToProps(store) {
|
||||
return {
|
||||
email: store.account.email,
|
||||
|
||||
Reference in New Issue
Block a user