diff options
Diffstat (limited to 'src/index.tsx')
-rw-r--r-- | src/index.tsx | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/index.tsx b/src/index.tsx index e029577..5975284 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -3,7 +3,7 @@ import { Hono } from "hono"; import { createClient } from "@libsql/client"; import { drizzle } from "drizzle-orm/libsql"; import { groupTable } from "./db/schema.js"; -import authRouter, { LoginForm } from "./auth.js"; +import authRouter, { getSession, LoginForm } from "./auth.js"; export const RP_ID = "localhost"; // "uneven.0m.nu"; export const ORIGIN = `http://${RP_ID}`; @@ -38,13 +38,16 @@ app.get("/", c => c.html( )); let colors = ["red", "green", "blue"]; -app.get("/button", c => c.html( - <button - hx-get="/button" - hx-swap="outerHTML" - style={{ backgroundColor: colors[Math.floor(Math.random() * colors.length)] }} - >disco button!</button> -)); +app.get("/button", async c => { + let session = await getSession(c); + return c.html( + <button + hx-get="/button" + hx-swap="outerHTML" + style={{ backgroundColor: colors[Math.floor(Math.random() * colors.length)] }} + >disco button! {session.user.name}</button> + ); +}); app.route("/auth", authRouter); |