feat: working login and logged out

This commit is contained in:
2026-09-10 23:40:08 +02:00
parent 300b1ce774
commit ac56bf4894
7 changed files with 97 additions and 24 deletions
+21 -3
View File
@@ -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>
);
});