Repository navigation
Expand file tree
/
Copy pathApp.js
More file actions
52 lines (48 loc) · 1.41 KB
/
Copy pathApp.js
File metadata and controls
52 lines (48 loc) · 1.41 KB
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
52
import React, { Component } from "react";
import { Route, Switch, Redirect } from "react-router-dom";
import {
IonApp,
IonRouterOutlet,
IonSpinner,
IonReactRouter
} from "@ionic/react";
import PrivateRoute from "./components/PrivateRoute";
import HomePage from "./pages/HomePage";
import LoginPage from "./pages/LoginPage";
import RegistrationPage from "./pages/RegistrationPage";
import TabOneDetailPage from "./pages/TabOneDetailPage";
import { inject, observer } from "mobx-react";
class App extends Component {
render() {
return !this.props.store.authCheckComplete ? (
<div
style={{
position: "absolute",
left: "50%",
top: "50%",
transform: "translate(-50%, -50%)"
}}
>
<IonSpinner name="circles" />
</div>
) : (
<IonReactRouter>
<IonApp>
<Switch>
<Redirect exact from="/" to="home" />
<Route path="/login" component={LoginPage} />
<IonRouterOutlet>
<Route path="/register" component={RegistrationPage} />
<PrivateRoute name="home" path="/home" component={HomePage} />
<PrivateRoute
path="/tab1-detail/:id"
component={TabOneDetailPage}
/>
</IonRouterOutlet>
</Switch>
</IonApp>
</IonReactRouter>
);
}
}
export default inject("store")(observer(App));