diff --git a/client/coral-framework/graphql/fragments.js b/client/coral-framework/graphql/fragments.js index c5704f719..bf75fa1a8 100644 --- a/client/coral-framework/graphql/fragments.js +++ b/client/coral-framework/graphql/fragments.js @@ -26,6 +26,7 @@ export default { 'UpdateAssetSettingsResponse', 'UpdateAssetStatusResponse', 'UpdateSettingsResponse', - 'ChangePasswordResponse' + 'ChangePasswordResponse', + 'UpdateEmailAddressResponse' ), }; diff --git a/client/coral-framework/graphql/mutations.js b/client/coral-framework/graphql/mutations.js index 228911d4a..fe9ee4ac4 100644 --- a/client/coral-framework/graphql/mutations.js +++ b/client/coral-framework/graphql/mutations.js @@ -321,6 +321,27 @@ const SetUsernameFragment = gql` } `; +export const withUpdateEmailAddress = withMutation( + gql` + mutation UpdateEmailAddress($input: UpdateEmailAddressInput!) { + updateEmailAddress(input: $input) { + ...UpdateEmailAddressResponse + } + } + `, + { + props: ({ mutate }) => ({ + updateEmailAdress: input => { + return mutate({ + variables: { + input, + }, + }); + }, + }), + } +); + export const withChangeUsername = withMutation( gql` mutation ChangeUsername($id: ID!, $username: String!) { diff --git a/plugin-api/beta/client/hocs/index.js b/plugin-api/beta/client/hocs/index.js index d7ca5fce9..d33e7acc9 100644 --- a/plugin-api/beta/client/hocs/index.js +++ b/plugin-api/beta/client/hocs/index.js @@ -27,5 +27,6 @@ export { withSetCommentStatus, withChangePassword, withChangeUsername, + withUpdateEmailAddress, } from 'coral-framework/graphql/mutations'; export { compose } from 'recompose'; diff --git a/plugins/talk-plugin-auth/client/profile-settings/containers/Profile.js b/plugins/talk-plugin-auth/client/profile-settings/containers/Profile.js index 5495888b0..d47f4af38 100644 --- a/plugins/talk-plugin-auth/client/profile-settings/containers/Profile.js +++ b/plugins/talk-plugin-auth/client/profile-settings/containers/Profile.js @@ -3,10 +3,15 @@ import { bindActionCreators } from 'redux'; import { connect } from 'plugin-api/beta/client/hocs'; import Profile from '../components/Profile'; import { notify } from 'coral-framework/actions/notification'; -import { withChangeUsername } from 'plugin-api/beta/client/hocs'; +import { + withChangeUsername, + withUpdateEmailAddress, +} from 'plugin-api/beta/client/hocs'; const mapDispatchToProps = dispatch => bindActionCreators({ notify }, dispatch); -export default compose(connect(null, mapDispatchToProps), withChangeUsername)( - Profile -); +export default compose( + connect(null, mapDispatchToProps), + withChangeUsername, + withUpdateEmailAddress +)(Profile);