aboutsummaryrefslogtreecommitdiffstats
path: root/src/containers/auth/ImportScreen.tsx
blob: 8d318cb2dd8bdfee5af58189f666457a6be264c5 (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
36
import { Component } from 'react';
import { inject, observer } from 'mobx-react';
import { RouterStore } from 'mobx-react-router';
import { UserStore } from 'src/stores.types';
import Import from '../../components/auth/Import';

interface IProps {
  actions: {
    user: UserStore;
  };
  stores: {
    user: UserStore;
    router: RouterStore;
  };
}

class ImportScreen extends Component<IProps> {
  render() {
    const { actions, stores } = this.props;

    if (stores.user.isImportLegacyServicesCompleted) {
      stores.router.push(stores.user.inviteRoute);
    }

    return (
      <Import
        services={stores.user.legacyServices}
        onSubmit={actions.user.importLegacyServices}
        isSubmitting={stores.user.isImportLegacyServicesExecuting}
        inviteRoute={stores.user.inviteRoute}
      />
    );
  }
}

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