From 2e084e9d77ae9ba3fe73801beb35b12b3459f549 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 21 Apr 2020 12:35:57 -0500 Subject: [PATCH] Fetch account data from profile_page --- app/gabsocial/pages/profile_page.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/gabsocial/pages/profile_page.js b/app/gabsocial/pages/profile_page.js index e50624158..1d8f89f7d 100644 --- a/app/gabsocial/pages/profile_page.js +++ b/app/gabsocial/pages/profile_page.js @@ -11,6 +11,8 @@ import LinkFooter from '../features/ui/components/link_footer'; import SignUpPanel from '../features/ui/components/sign_up_panel'; import ProfileInfoPanel from '../features/ui/components/profile_info_panel'; import { acctFull } from 'gabsocial/utils/accounts'; +import { fetchAccount, fetchAccountByUsername } from '../actions/accounts'; +import { fetchAccountIdentityProofs } from '../actions/identity_proofs'; const mapStateToProps = (state, { params: { username }, withReplies = false }) => { const accounts = state.getIn(['accounts']); @@ -44,8 +46,20 @@ class ProfilePage extends ImmutablePureComponent { accountUsername: PropTypes.string.isRequired, }; + componentWillMount() { + const { params: { username }, accountId, me } = this.props; + + if (accountId && accountId !== -1) { + this.props.dispatch(fetchAccount(accountId)); + if (me) this.props.dispatch(fetchAccountIdentityProofs(accountId)); + } else { + this.props.dispatch(fetchAccountByUsername(username)); + } + } + render() { const { children, accountId, account, accountUsername } = this.props; + if (!account) return null; const bg = account.getIn(['customizations', 'background']); return (