feat: working login and logged out
This commit is contained in:
+21
-3
@@ -1,5 +1,23 @@
|
||||
import { define } from "../utils.ts";
|
||||
import Headline from "../components/Headline.tsx";
|
||||
import { define, isLoggedIn } from "../utils.ts";
|
||||
|
||||
export default define.page(function Dashboard(ctx) {
|
||||
return <h1>Dashboard</h1>;
|
||||
export const handler = define.handlers({
|
||||
GET(ctx) {
|
||||
console.log("ASDF");
|
||||
if (!isLoggedIn(ctx.req)) {
|
||||
const url = new URL(ctx.req.url);
|
||||
url.pathname = "/sign-in";
|
||||
return Response.redirect(url, 303);
|
||||
}
|
||||
|
||||
return { data: {} };
|
||||
},
|
||||
});
|
||||
|
||||
export default define.page<typeof handler>(function Dashboard(_ctx) {
|
||||
return (
|
||||
<div class="container mx-auto p-4">
|
||||
<Headline>Dashboard</Headline>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user