blob: 02d98dcacf107b3ff1029c7996bd9237058de25a (
plain)
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
|
import React, { Component } from 'react';
import ContainerDimensions from 'react-container-dimensions';
import MainToobar from './MainToolbar';
import MainMap from './MainMap';
class MainPage extends Component {
constructor(props) {
super(props);
this.state = {
loading: true
};
}
componentDidMount() {
fetch('/api/session').then(response => {
if (response.ok) {
this.setState({
loading: false
});
} else {
this.props.history.push('/login');
}
});
}
render() {
const { loading } = this.state;
if (loading) {
return (
<div>Loading...</div>
);
} else {
return (
<div style={{height: "100vh", display: "flex", flexDirection: "column"}}>
<div style={{flex: 0}}>
<MainToobar />
</div>
<div style={{flex: 1}}>
<ContainerDimensions>
<MainMap/>
</ContainerDimensions>
</div>
</div>
);
}
}
}
export default MainPage;
|