Files
Speedtest-Tracker/resources/js/index.js
Henry Whitaker 4f79645191 Removed auth
Doesn't really need user account, no sensitive data held in DB, plus routes that do stuff are rate limited anyway.

Shouldn't be accessible to untrusted users (i.e. should be behind a RP that handles user auth)
2020-04-08 19:45:20 +01:00

44 lines
1.4 KiB
JavaScript
Vendored

import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter, Switch, Route, Redirect, useHistory } from 'react-router-dom';
import Axios from 'axios';
import ErrorPage from './components/ErrorPage';
import Loader from './components/Loader';
import Login from './components/Login';
import { ToastContainer } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import HomePage from './components/Home/HomePage';
export default class Index extends Component {
constructor(props) {
super(props)
this.state = {
loading: true,
}
}
render() {
var loading = this.state.loading;
return (
<BrowserRouter>
<Route render={(props) => (<ToastContainer />)} />
<Switch>
<Route exact path="/" render={(props) => (
<div>
<HomePage />
</div>
)} />
<Route exact path="/error/:code" render={(props) => ( <ErrorPage code={props.match.params.code} /> )} />
<Route render={(props) => (<ErrorPage code="404" />)} />
</Switch>
</BrowserRouter>
);
}
}
if (document.getElementById('main')) {
ReactDOM.render(<Index />, document.getElementById('main'));
}