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.

43 lines
1.6 KiB

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