2020-05-02 03:03:19 +02:00
|
|
|
import React from "react";
|
|
|
|
|
import { Route, Switch } from "react-router-dom";
|
2020-05-02 21:46:05 +02:00
|
|
|
import { LoginFailure } from "./components/LoginFailure";
|
2020-05-13 21:22:56 +02:00
|
|
|
import { LoginSuccess } from "./components/LoginSuccess";
|
2020-05-02 03:03:19 +02:00
|
|
|
import { NavBar } from "./components/NavBar";
|
2020-05-09 19:22:43 +02:00
|
|
|
import { RecentListens } from "./components/RecentListens";
|
|
|
|
|
import { ReportListens } from "./components/ReportListens";
|
2020-05-02 03:03:19 +02:00
|
|
|
import { useAuth } from "./hooks/use-auth";
|
|
|
|
|
import "./tailwind/generated.css";
|
|
|
|
|
|
|
|
|
|
export function App() {
|
|
|
|
|
const { isLoaded } = useAuth();
|
|
|
|
|
|
|
|
|
|
if (!isLoaded) {
|
|
|
|
|
return <div>Loading...</div>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="App">
|
|
|
|
|
<header>
|
|
|
|
|
<NavBar />
|
|
|
|
|
</header>
|
|
|
|
|
<Switch>
|
|
|
|
|
<Route path="/" exact />
|
2020-05-13 21:22:56 +02:00
|
|
|
<Route path="/login/success" exact component={LoginSuccess} />
|
2020-05-02 21:46:05 +02:00
|
|
|
<Route path="/login/failure" exact component={LoginFailure} />
|
2020-05-02 21:46:41 +02:00
|
|
|
<Route path="/listens" exact component={RecentListens} />
|
2020-05-09 19:22:43 +02:00
|
|
|
<Route path="/reports/listens" exact component={ReportListens} />
|
2020-05-02 03:03:19 +02:00
|
|
|
</Switch>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|