import { readAccounts } from "~/server/database"; export default defineEventHandler(async (event) => { const { name } = await readBody(event); if (!name) { return new Response(undefined, { status: 400 }) } const accounts = await readAccounts(); const account = accounts.find(a => a.name === name); if (!account) { return new Response(undefined, { status: 403 }) } await setAccountSession(event, account.id); })