index.tsx
1.9 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
import * as React from "react";
import { Switch, Route } from "react-router-dom";
import RequestPage from "components/pages/RequestPage";
import DronePage from "components/pages/DronePage";
import HomePage from "components/pages/HomePage";
import RegisterPage from "components/pages/RegisterPage";
import MyPage from "components/pages/MyPage";
import ContractPage from "components/pages/ContractPage";
import LoginPage from "components/pages/LoginPage";
import OrgPage from "components/pages/OrgPage";
import BuyPage from "components/pages/BuyPage";
import DatasetPage from "components/pages/DatasetPage";
import SearchPage from "components/pages/SearchPage";
import JudgePage from "components/pages/JudgePage";
import { withRouter, RouteComponentProps } from "react-router-dom";
require("./styles.scss");
interface MyProps extends RouteComponentProps<{}> {}
class Main extends React.Component<MyProps> {
componentDidUpdate(prevProps) {
if (this.props.location !== prevProps.location) window.scrollTo(0, 0);
}
public render() {
return (
<main className="Main">
<Switch>
<Route exact path="/" component={HomePage} />
<Route exact path="/request" component={RequestPage} />
<Route exact path="/drone" component={DronePage} />
<Route exact path="/register" component={RegisterPage} />
<Route exact path="/my-page" component={MyPage} />
<Route exact path="/contract/:id" component={ContractPage} />
<Route exact path="/org" component={OrgPage} />
<Route exact path="/buy" component={BuyPage} />
<Route exact path="/judge/:id" component={JudgePage} />
<Route exact path="/search/:id" component={SearchPage} />
<Route exact path="/dataset" component={DatasetPage} />
<Route exact path="/login" component={LoginPage} />
</Switch>
</main>
);
}
}
export default withRouter(Main);