Skip to content
Snippets Groups Projects
Commit 6c849d25 authored by Giannis Kopanas's avatar Giannis Kopanas
Browse files

refactor(signup): migrate sign up to graphql

parent de9c37c2
No related branches found
No related tags found
No related merge requests found
module.exports = {
client: {
components: [() => require('./src/SignupContainer')],
},
}
{
"name": "pubsweet-component-signup",
"name": "editoria-component-signup",
"version": "1.0.41",
"description": "Basic signup form component for PubSweet",
"main": "index.js",
......@@ -9,19 +9,16 @@
"@pubsweet/ui": "^9.1.3",
"@pubsweet/ui-toolkit": "2.0.7",
"formik": "^1.3.0",
"styled-components": "^4.1.1",
"prop-types": "^15.5.10",
"react-bootstrap": "^0.32.0",
"react-redux": "^5.0.6",
"react-router": "^4.2.0",
"recompose": "^0.30.0",
"redux": "^3.7.2",
"redux-form": "^7.4.2"
"prop-types": "^15.5.10",
"recompose": "^0.30.0"
},
"peerDependencies": {
"graphql-tag": "^2.10.0",
"pubsweet-client": ">=1.0.0",
"react": ">=16",
"react-router-redux": "^4.0.8"
"react-apollo": "^2.3.3",
"react-router": "^4.3.1",
"styled-components": "^4.1.3"
},
"repository": {
"type": "git",
......
......@@ -30,7 +30,7 @@ const EmailInput = props => (
const PasswordInput = props => (
<TextField
label="Password"
{...props.input}
{...props.field}
placeholder="Password"
type="password"
/>
......
import { compose } from 'recompose'
import { withFormik } from 'formik'
import { graphql } from 'react-apollo'
import { SIGNUP_USER } from './graphql/mutations'
import { signupUser } from './actions'
import Signup from './Signup'
const handleSubmit = (values, dispatch) => {
dispatch(signupUser(values))
}
const handleSubmit = (values, { props, setSubmitting, setErrors }) =>
props.signupUser({
variables: { input: values },
})
const enhancedFormik = withFormik({
initialValues: {
......@@ -14,8 +16,17 @@ const enhancedFormik = withFormik({
email: '',
password: '',
},
mapPropsToValues: props => ({
username: props.username,
password: props.password,
email: props.email,
}),
displayName: 'signup',
handleSubmit,
})(Signup)
export default compose()(enhancedFormik)
export default compose(
graphql(SIGNUP_USER, {
name: 'signupUser',
}),
)(enhancedFormik)
import gql from 'graphql-tag'
export const SIGNUP_USER = gql`
mutation($input: UserInput) {
createUser(input: $input) {
id
type
username
email
}
}
`
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment