aboutsummaryrefslogtreecommitdiffstats
path: root/src/containers/auth/SignupScreen.tsx
blob: cf5d8006ef142e9e04502503519909da9b884e7b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { inject, observer } from 'mobx-react';
import { Component, type ReactElement } from 'react';

import type {
  GlobalError,
  StoresProps,
} from '../../@types/ferdium-components.types';
import Signup from '../../components/auth/Signup';

interface SignUpScreenComponents extends StoresProps {
  error: GlobalError;
}

class SignupScreen extends Component<SignUpScreenComponents> {
  onSignup(values: any): void {
    const { actions } = this.props;

    actions.user.signup(values);
  }

  render(): ReactElement {
    const { stores, error } = this.props;

    return (
      <Signup
        onSubmit={values => this.onSignup(values)}
        isSubmitting={stores.user.signupRequest.isExecuting}
        loginRoute={stores.user.loginRoute}
        error={error}
      />
    );
  }
}

export default inject('stores', 'actions')(observer(SignupScreen));