2018-02-26 00:11:31 +00:00
|
|
|
import React, { Component } from 'react';
|
2020-02-09 10:21:13 +00:00
|
|
|
import { Switch, Redirect } from 'react-router';
|
2018-02-26 00:11:31 +00:00
|
|
|
|
2019-05-14 21:47:04 +00:00
|
|
|
import * as Authentication from './authentication/Authentication';
|
|
|
|
import AuthenticationWrapper from './authentication/AuthenticationWrapper';
|
2019-05-19 20:22:01 +00:00
|
|
|
import UnauthenticatedRoute from './authentication/UnauthenticatedRoute';
|
2020-02-09 10:21:13 +00:00
|
|
|
import AuthenticatedRoute from './authentication/AuthenticatedRoute';
|
|
|
|
|
|
|
|
import SignIn from './SignIn';
|
2019-07-06 22:56:30 +00:00
|
|
|
import ProjectRouting from './project/ProjectRouting';
|
2020-02-09 10:21:13 +00:00
|
|
|
import WiFiConnection from './wifi/WiFiConnection';
|
|
|
|
import AccessPoint from './ap/AccessPoint';
|
|
|
|
import NetworkTime from './ntp/NetworkTime';
|
|
|
|
import Security from './security/Security';
|
|
|
|
import System from './system/System';
|
|
|
|
|
|
|
|
import { PROJECT_PATH } from './api';
|
2020-05-14 22:23:45 +00:00
|
|
|
import Mqtt from './mqtt/Mqtt';
|
2018-02-26 00:11:31 +00:00
|
|
|
|
|
|
|
class AppRouting extends Component {
|
2019-05-14 21:47:04 +00:00
|
|
|
|
2020-02-09 10:21:13 +00:00
|
|
|
componentDidMount() {
|
2019-05-14 21:47:04 +00:00
|
|
|
Authentication.clearLoginRedirect();
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<AuthenticationWrapper>
|
|
|
|
<Switch>
|
2020-02-09 10:21:13 +00:00
|
|
|
<UnauthenticatedRoute exact path="/" component={SignIn} />
|
|
|
|
<AuthenticatedRoute exact path={`/${PROJECT_PATH}/*`} component={ProjectRouting} />
|
|
|
|
<AuthenticatedRoute exact path="/wifi/*" component={WiFiConnection} />
|
2019-05-26 20:27:35 +00:00
|
|
|
<AuthenticatedRoute exact path="/ap/*" component={AccessPoint} />
|
|
|
|
<AuthenticatedRoute exact path="/ntp/*" component={NetworkTime} />
|
2020-05-14 22:23:45 +00:00
|
|
|
<AuthenticatedRoute exact path="/mqtt/*" component={Mqtt} />
|
2020-02-09 10:21:13 +00:00
|
|
|
<AuthenticatedRoute exact path="/security/*" component={Security} />
|
|
|
|
<AuthenticatedRoute exact path="/system/*" component={System} />
|
2019-05-14 21:47:04 +00:00
|
|
|
<Redirect to="/" />
|
|
|
|
</Switch>
|
|
|
|
</AuthenticationWrapper>
|
|
|
|
)
|
|
|
|
}
|
2018-02-26 00:11:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default AppRouting;
|