WordClockESP/interface/src/AppRouting.tsx

46 lines
1.7 KiB
TypeScript
Raw Normal View History

import React, { Component } from 'react';
import { Switch, Redirect } from 'react-router';
2019-05-14 21:47:04 +00:00
import * as Authentication from './authentication/Authentication';
import AuthenticationWrapper from './authentication/AuthenticationWrapper';
import UnauthenticatedRoute from './authentication/UnauthenticatedRoute';
import AuthenticatedRoute from './authentication/AuthenticatedRoute';
import SignIn from './SignIn';
2019-07-06 22:56:30 +00:00
import ProjectRouting from './project/ProjectRouting';
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';
import Mqtt from './mqtt/Mqtt';
class AppRouting extends Component {
2019-05-14 21:47:04 +00:00
componentDidMount() {
2019-05-14 21:47:04 +00:00
Authentication.clearLoginRedirect();
}
render() {
return (
<AuthenticationWrapper>
<Switch>
<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} />
<AuthenticatedRoute exact path="/mqtt/*" component={Mqtt} />
<AuthenticatedRoute exact path="/security/*" component={Security} />
<AuthenticatedRoute exact path="/system/*" component={System} />
2019-05-14 21:47:04 +00:00
<Redirect to="/" />
</Switch>
</AuthenticationWrapper>
)
}
}
export default AppRouting;