Addin g withUpdateEmailAddress

This commit is contained in:
okbel
2018-04-30 16:28:08 -03:00
parent 35e8c005f3
commit 58108f257f
4 changed files with 33 additions and 5 deletions
+2 -1
View File
@@ -26,6 +26,7 @@ export default {
'UpdateAssetSettingsResponse',
'UpdateAssetStatusResponse',
'UpdateSettingsResponse',
'ChangePasswordResponse'
'ChangePasswordResponse',
'UpdateEmailAddressResponse'
),
};
@@ -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!) {
+1
View File
@@ -27,5 +27,6 @@ export {
withSetCommentStatus,
withChangePassword,
withChangeUsername,
withUpdateEmailAddress,
} from 'coral-framework/graphql/mutations';
export { compose } from 'recompose';
@@ -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);