Fork of the excellent esp8266-react - https://github.com/rjwats/esp8266-react
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.6 KiB

5 years ago
5 years ago
  1. import React, { Component } from 'react';
  2. import { Redirect, Switch } from 'react-router';
  3. import { PROJECT_PATH } from './constants/Env';
  4. import * as Authentication from './authentication/Authentication';
  5. import AuthenticationWrapper from './authentication/AuthenticationWrapper';
  6. import AuthenticatedRoute from './authentication/AuthenticatedRoute';
  7. import UnauthenticatedRoute from './authentication/UnauthenticatedRoute';
  8. import SignInPage from './containers/SignInPage';
  9. import WiFiConnection from './sections/WiFiConnection';
  10. import AccessPoint from './sections/AccessPoint';
  11. import NetworkTime from './sections/NetworkTime';
  12. import Security from './sections/Security';
  13. import System from './sections/System';
  14. import ProjectRouting from './project/ProjectRouting';
  15. class AppRouting extends Component {
  16. componentWillMount() {
  17. Authentication.clearLoginRedirect();
  18. }
  19. render() {
  20. return (
  21. <AuthenticationWrapper>
  22. <Switch>
  23. <UnauthenticatedRoute exact path="/" component={SignInPage} />
  24. <AuthenticatedRoute exact path="/wifi/*" component={WiFiConnection} />
  25. <AuthenticatedRoute exact path="/ap/*" component={AccessPoint} />
  26. <AuthenticatedRoute exact path="/ntp/*" component={NetworkTime} />
  27. <AuthenticatedRoute exact path="/security/*" component={Security} />
  28. <AuthenticatedRoute exact path="/system/*" component={System} />
  29. <AuthenticatedRoute exact path={`/${PROJECT_PATH}/*`} component={ProjectRouting} />
  30. <Redirect to="/" />
  31. </Switch>
  32. </AuthenticationWrapper>
  33. )
  34. }
  35. }
  36. export default AppRouting;