|
@@ -27,32 +27,48 @@ class UserCreate extends React.Component {
|
|
|
}
|
|
|
|
|
|
render() {
|
|
|
- <Mutation
|
|
|
- mutation={USER_CREATE}
|
|
|
- variables={this.state}
|
|
|
- refetchQueries={[{ query: CURRENT_USER }]}
|
|
|
- >
|
|
|
- {(userCreate, { error, loading }) => (
|
|
|
- <form
|
|
|
- method="POST"
|
|
|
- onSubmit={async event => {
|
|
|
- event.preventDefault()
|
|
|
- await userCreate()
|
|
|
- this.setState({ name: '', email: '', abbreviation: '', password: '' })
|
|
|
- }}
|
|
|
- >
|
|
|
- <input type="text" name="name" id="name" value={this.state.name} onChange={this.handleInput} />
|
|
|
- <label htmlFor="name"></label>
|
|
|
- <input type="text" name="abbreviation" id="abbreviation" value={this.state.abbreviation} onChange={this.handleInput} />
|
|
|
- <label htmlFor="abbreviation"></label>
|
|
|
- <input type="text" name="email" id="email" value={this.state.email} onChange={this.handleInput} />
|
|
|
- <label htmlFor="email"></label>
|
|
|
- <input type="password" name="password" id="password" value={this.state.password} onChange={this.handleInput} />
|
|
|
- <label htmlFor="password"></label>
|
|
|
- <button type="submit">Create</button>
|
|
|
- </form>
|
|
|
- )}
|
|
|
- </Mutation>
|
|
|
+ return (
|
|
|
+ <Mutation
|
|
|
+ mutation={USER_CREATE}
|
|
|
+ variables={this.state}
|
|
|
+ refetchQueries={[{ query: CURRENT_USER }]}
|
|
|
+ >
|
|
|
+ {(userCreate, { error, loading }) => (
|
|
|
+ <form
|
|
|
+ method="POST"
|
|
|
+ onSubmit={async event => {
|
|
|
+ event.preventDefault()
|
|
|
+ await userCreate()
|
|
|
+ this.setState({ name: '', email: '', abbreviation: '', password: '' })
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <fieldset>
|
|
|
+ <label htmlFor="name">User name</label>
|
|
|
+ <input type="text" name="name" id="name"
|
|
|
+ placeholder="User name"
|
|
|
+ value={this.state.name}
|
|
|
+ onChange={this.handleInput} />
|
|
|
+ <label htmlFor="abbreviation">Abbreviation</label>
|
|
|
+ <input type="text" name="abbreviation" id="abbreviation"
|
|
|
+ placeholder="Abbreviation"
|
|
|
+ value={this.state.abbreviation}
|
|
|
+ onChange={this.handleInput} />
|
|
|
+ <label htmlFor="email">Email</label>
|
|
|
+ <input type="email" name="email" id="email"
|
|
|
+ placeholder="Email"
|
|
|
+ value={this.state.email}
|
|
|
+ onChange={this.handleInput} />
|
|
|
+ <label htmlFor="password">Password</label>
|
|
|
+ <input type="password" name="password" id="password"
|
|
|
+ placeholder="Password"
|
|
|
+ value={this.state.password}
|
|
|
+ onChange={this.handleInput} />
|
|
|
+ <button type="submit">Create</button>
|
|
|
+ </fieldset>
|
|
|
+ </form>
|
|
|
+ )}
|
|
|
+ </Mutation>
|
|
|
+ )
|
|
|
}
|
|
|
}
|
|
|
|