aboutsummaryrefslogtreecommitdiffstats
path: root/src/containers/auth/ImportScreen.tsx
blob: 756a2e59cdcfe6f0c0ff32282fa78b34d4011bae (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 Import from '../../components/auth/Import';
import UserStore from '../../stores/UserStore';

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));