Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- submit = user => {
- console.log("yyy = " + JSON.stringify(user));
- }
- render() {
- const { isAuthenticated, email } = this.props;
- return (
- <div>
- <DashboardForm submit={this.submit} { ...this.props } />
- </div>
- );
- <Form onSubmit={this.onSubmit} loading={loading}>
- <Button primary> Update My Profile </Button>
- </Form>
- onSubmit = () => {
- const errors = this.validate(this.state.user);
- this.setState({ errors });
- if (Object.keys(errors).length === 0) {
- this.setState({ loading: true });
- this.props
- .submit(this.state.user)
- .catch(err =>
- this.setState({ errors: err.response.data.errors, loading: false })
- );
- }
- state = {
- user: {
- email: "",
- firstname: "",
- lastname: "",
- address1: "",
- address2: "",
- st: "",
- preferredContactMethod: "",
- cellphone: "",
- homephone: ""
- },
- loading: false,
- errors: {}
Add Comment
Please, Sign In to add comment