Fetch account data from profile_page

merge-requests/1/head
Alex Gleason 2020-04-21 12:35:57 -05:00
rodzic a4fe106e7f
commit 2e084e9d77
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 14 dodań i 0 usunięć

Wyświetl plik

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