diff options
Diffstat (limited to 'src/containers/auth/SetupAssistantScreen.js')
-rw-r--r-- | src/containers/auth/SetupAssistantScreen.js | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/src/containers/auth/SetupAssistantScreen.js b/src/containers/auth/SetupAssistantScreen.js index 2a8f2c010..d7036969a 100644 --- a/src/containers/auth/SetupAssistantScreen.js +++ b/src/containers/auth/SetupAssistantScreen.js | |||
@@ -4,14 +4,28 @@ import PropTypes from 'prop-types'; | |||
4 | import { inject, observer } from 'mobx-react'; | 4 | import { inject, observer } from 'mobx-react'; |
5 | 5 | ||
6 | import { RouterStore } from 'mobx-react-router'; | 6 | import { RouterStore } from 'mobx-react-router'; |
7 | import { DEFAULT_TODO_RECIPE_ID, DEFAULT_TODO_SERVICE_NAME } from '../../config'; | 7 | import { |
8 | DEFAULT_TODO_RECIPE_ID, | ||
9 | DEFAULT_TODO_SERVICE_NAME, | ||
10 | } from '../../config'; | ||
8 | import { sleep } from '../../helpers/async-helpers'; | 11 | import { sleep } from '../../helpers/async-helpers'; |
9 | import SetupAssistant from '../../components/auth/SetupAssistant'; | 12 | import SetupAssistant from '../../components/auth/SetupAssistant'; |
10 | import ServicesStore from '../../stores/ServicesStore'; | 13 | import ServicesStore from '../../stores/ServicesStore'; |
11 | import RecipesStore from '../../stores/RecipesStore'; | 14 | import RecipesStore from '../../stores/RecipesStore'; |
12 | import UserStore from '../../stores/UserStore'; | 15 | import UserStore from '../../stores/UserStore'; |
13 | 16 | ||
14 | export default @inject('stores', 'actions') @observer class SetupAssistantScreen extends Component { | 17 | export default |
18 | @inject('stores', 'actions') | ||
19 | @observer | ||
20 | class SetupAssistantScreen extends Component { | ||
21 | constructor(props) { | ||
22 | super(props); | ||
23 | this.state = { | ||
24 | isSettingUpServices: false, | ||
25 | }; | ||
26 | } | ||
27 | |||
28 | // TODO: Why are these hardcoded here? Do they need to conform to specific services in the packaged recipes? If so, its more important to fix this | ||
15 | services = { | 29 | services = { |
16 | whatsapp: { | 30 | whatsapp: { |
17 | name: 'WhatsApp', | 31 | name: 'WhatsApp', |
@@ -49,21 +63,18 @@ export default @inject('stores', 'actions') @observer class SetupAssistantScreen | |||
49 | name: 'LinkedIn', | 63 | name: 'LinkedIn', |
50 | hasTeamId: false, | 64 | hasTeamId: false, |
51 | }, | 65 | }, |
52 | } | 66 | }; |
53 | |||
54 | state = { | ||
55 | isSettingUpServices: false, | ||
56 | } | ||
57 | 67 | ||
58 | async setupServices(serviceConfig) { | 68 | async setupServices(serviceConfig) { |
59 | const { stores: { services, router, user } } = this.props; | 69 | const { |
60 | console.log(serviceConfig); | 70 | stores: { services }, |
71 | } = this.props; | ||
61 | 72 | ||
62 | this.setState({ | 73 | this.setState({ |
63 | isSettingUpServices: true, | 74 | isSettingUpServices: true, |
64 | }); | 75 | }); |
65 | 76 | ||
66 | // The store requests are not build for paralell requests so we need to finish one request after another | 77 | // The store requests are not build for parallel requests so we need to finish one request after another |
67 | for (const config of serviceConfig) { | 78 | for (const config of serviceConfig) { |
68 | const serviceData = { | 79 | const serviceData = { |
69 | name: this.services[config.id].name, | 80 | name: this.services[config.id].name, |
@@ -96,10 +107,6 @@ export default @inject('stores', 'actions') @observer class SetupAssistantScreen | |||
96 | this.setState({ | 107 | this.setState({ |
97 | isSettingUpServices: false, | 108 | isSettingUpServices: false, |
98 | }); | 109 | }); |
99 | |||
100 | await sleep(100); | ||
101 | |||
102 | router.push(user.pricingRoute); | ||
103 | } | 110 | } |
104 | 111 | ||
105 | render() { | 112 | render() { |