-
Notifications
You must be signed in to change notification settings - Fork 3
/
App.react.js
51 lines (45 loc) · 1.42 KB
/
App.react.js
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
41
42
43
44
45
46
47
48
49
50
51
import React, { PureComponent } from 'react';
import { BrowserRouter as Router, Route, withRouter } from 'react-router-dom';
import PropTypes from 'prop-types';
import { I18nManager } from '@opuscapita/i18n';
import { uiMessageNotifications } from '../uiGlobalComponents';
import Menu from './Menu.react';
import HomePage from './HomePage.react';
import Editor from './Editor.react';
import WorkflowHistory from './History.react';
import { notificationSuccess, notificationError } from '../constants';
import { baseUrl } from '../utils';
import './styles.css';
export default class App extends PureComponent {
static childContextTypes = {
i18n: PropTypes.object.isRequired,
uiMessageNotifications: PropTypes.object.isRequired
}
constructor(...args) {
super(...args);
this.i18n = new I18nManager();
}
getChildContext() {
return {
i18n: this.i18n,
uiMessageNotifications
}
}
componentWillUnmount() {
uiMessageNotifications.remove({ id: notificationSuccess })
uiMessageNotifications.remove({ id: notificationError })
}
render() {
const MyMenu = withRouter(Menu);
return (
<Router basename={baseUrl}>
<div>
<MyMenu/>
<Route exact={true} path='/' component={HomePage}/>
<Route exact={true} path='/editor' component={Editor}/>
<Route path='/invoice/:objectId' component={WorkflowHistory}/>
</div>
</Router>
)
}
}