24 lines
899 B
TypeScript
24 lines
899 B
TypeScript
/** @jsx jsx */
|
|
|
|
import { jsx } from "https://deno.land/x/hono@v4.3.10/middleware.ts"
|
|
import { BasePage } from "./components/base.tsx";
|
|
import Heading from "./components/heading.tsx";
|
|
import Main from "./components/main.tsx";
|
|
import Login from "./components/login.tsx";
|
|
import { User } from "../lib/storage.ts";
|
|
import { Context } from "https://deno.land/x/hono@v4.3.10/mod.ts";
|
|
import { FeurEnv } from "../main.ts";
|
|
import { BlankInput } from "https://deno.land/x/hono@v4.3.10/types.ts";
|
|
import { get_user } from "../lib/auth.ts";
|
|
|
|
export default async function UserPage(context: Context<FeurEnv, string, BlankInput>) {
|
|
const user = await get_user(context);
|
|
if (user === null) return context.text("Must be logged.", 401);
|
|
return context.html(
|
|
<BasePage name="Login">
|
|
<Main>
|
|
<h1>Logged as {await user.get("username")}</h1>
|
|
</Main>
|
|
</BasePage>
|
|
)
|
|
}
|