-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
40 lines (35 loc) · 1.16 KB
/
App.tsx
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
37
38
39
40
import 'utils/debug';
import React from 'react';
import { connect, Provider } from 'react-redux';
import { createReduxContainer } from 'react-navigation-redux-helpers';
import { store } from 'src/store';
import { AppNavigator } from 'Navigation/AppNavigator';
import { ApiConnector } from 'Bootstrap/ApiConnector';
import { AppState } from 'src/types/state';
import { BackButtonHandler } from 'Navigation/BackButtonHandler';
import {
registerLogoutInterceptor,
registerBackendErrorHandler,
} from 'src/api';
import { UserAction } from 'src/modules/User/reducers/userActions';
import { AlertContainer } from 'src/modules/Alert/AlertContainer';
registerLogoutInterceptor(store, UserAction.LOGOUT_SUCCESS);
registerBackendErrorHandler(store);
const mapStateToProps = (state: AppState) => ({
state: state.navigation,
});
const Navigator = connect(mapStateToProps)(
createReduxContainer(AppNavigator),
);
const Root = () => (
<Provider store={store}>
<BackButtonHandler>
<ApiConnector>
<Navigator />
<AlertContainer />
</ApiConnector>
</BackButtonHandler>
</Provider>
);
// tslint:disable-next-line: no-default-export
export default Root;