2021-06-18 20:07:26 +01:00
|
|
|
import { CheckAuth } from "./context/revoltjs/CheckAuth";
|
|
|
|
import { Route, Switch } from "react-router-dom";
|
2021-06-18 17:57:08 +01:00
|
|
|
import Context from "./context";
|
|
|
|
|
2021-06-18 20:21:54 +01:00
|
|
|
import { Login } from "./pages/login/Login";
|
|
|
|
|
2021-06-18 22:47:25 +01:00
|
|
|
import { useForceUpdate, useSelf, useUser } from "./context/revoltjs/hooks";
|
|
|
|
|
|
|
|
function Test() {
|
|
|
|
const ctx = useForceUpdate();
|
|
|
|
|
|
|
|
let self = useSelf(ctx);
|
|
|
|
let bree = useUser('01EZZJ98RM1YVB1FW9FG221CAN', ctx);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<h1>logged in as { self?.username }</h1>
|
|
|
|
<h4>bree: { JSON.stringify(bree) }</h4>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2021-06-18 12:05:01 +01:00
|
|
|
export function App() {
|
2021-06-18 15:57:08 +01:00
|
|
|
return (
|
2021-06-18 17:57:08 +01:00
|
|
|
<Context>
|
2021-06-18 20:07:26 +01:00
|
|
|
<Switch>
|
|
|
|
<Route path="/login">
|
|
|
|
<CheckAuth>
|
2021-06-18 20:21:54 +01:00
|
|
|
<Login />
|
2021-06-18 20:07:26 +01:00
|
|
|
</CheckAuth>
|
|
|
|
</Route>
|
|
|
|
<Route path="/">
|
|
|
|
<CheckAuth auth>
|
2021-06-18 22:47:25 +01:00
|
|
|
<Test />
|
2021-06-18 20:07:26 +01:00
|
|
|
</CheckAuth>
|
|
|
|
</Route>
|
|
|
|
</Switch>
|
2021-06-18 17:57:08 +01:00
|
|
|
</Context>
|
2021-06-18 15:57:08 +01:00
|
|
|
);
|
2021-06-18 12:05:01 +01:00
|
|
|
}
|