From c8e5678c9c7eb4d67d64a8a958ddf3af62127bc8 Mon Sep 17 00:00:00 2001 From: okbel Date: Wed, 2 May 2018 14:18:40 -0300 Subject: [PATCH] Using fragments :) --- .../client/containers/Profile.js | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/plugins/talk-plugin-local-auth/client/containers/Profile.js b/plugins/talk-plugin-local-auth/client/containers/Profile.js index d47f4af38..bebf127fd 100644 --- a/plugins/talk-plugin-local-auth/client/containers/Profile.js +++ b/plugins/talk-plugin-local-auth/client/containers/Profile.js @@ -1,6 +1,6 @@ -import { compose } from 'react-apollo'; +import { compose, gql } from 'react-apollo'; import { bindActionCreators } from 'redux'; -import { connect } from 'plugin-api/beta/client/hocs'; +import { connect, withFragments } from 'plugin-api/beta/client/hocs'; import Profile from '../components/Profile'; import { notify } from 'coral-framework/actions/notification'; import { @@ -10,8 +10,30 @@ import { const mapDispatchToProps = dispatch => bindActionCreators({ notify }, dispatch); +const withData = withFragments({ + root: gql` + fragment TalkPluginLocalAuth_Profile_root on RootQuery { + me { + id + state { + status { + username { + status + history { + status + created_at + } + } + } + } + } + } + `, +}); + export default compose( connect(null, mapDispatchToProps), withChangeUsername, - withUpdateEmailAddress + withUpdateEmailAddress, + withData )(Profile);