feat: refactoring, soem work on forms

This commit is contained in:
2026-09-13 23:17:37 +02:00
parent fa07d4cc0b
commit 0dbbe5361a
17 changed files with 260 additions and 116 deletions
+9
View File
@@ -0,0 +1,9 @@
import { define } from "../../utils.ts";
export default define.middleware((ctx) => {
if (!ctx.state.loggedIn) {
return ctx.redirect("/sign-in", 303);
}
return ctx.next();
});
+10
View File
@@ -0,0 +1,10 @@
import Headline from "../../components/Headline.tsx";
import { define } from "../../utils.ts";
export default define.page(function Dashboard() {
return (
<div class="container mx-auto p-4">
<Headline>Dashboard</Headline>
</div>
);
});
+15
View File
@@ -0,0 +1,15 @@
import { unsetAuthCookie } from "../../lib/auth.ts";
import { define } from "../../utils.ts";
export const handler = define.handlers({
POST(ctx) {
const headers = new Headers();
unsetAuthCookie(headers);
headers.set("location", new URL("/", ctx.req.url).toString());
return new Response(null, {
status: 303,
headers,
});
},
});