import { Handlers, PageProps } from "$fresh/server.ts"; import { getCookies } from "$std/http/cookie.ts"; import { Head } from "$fresh/runtime.ts"; interface Data { username: string; password: string; } export const handler: Handlers = { GET(req, ctx) { const cookies = getCookies(req.headers); const username = cookies["username"]; const password = cookies["password"]; if (username && password) { return ctx.render({ username, password }); } else { return new Response("", { status: 303, headers: { location: "/login" }, }); } }, }; export default function LibraryPage({ data }: PageProps) { const { username, password } = data; return ( <> musikspider

Library {username} {password}

); }