import { globalUserObject } from "../middleware/login"; export default defineEventHandler(async (event) => { const body = await readBody(event) let correctUsername; let correctPassword; if (globalUserObject !== null) { correctUsername = globalUserObject.username; correctPassword = globalUserObject.password; } let authorized = false; if (body.username == correctUsername && body.password == correctPassword) { authorized = true; } if (!authorized) { throw createError({ statusCode: 400, statusMessage: 'Username or password not valid.', }) } setResponseStatus(event, 202) return 'Successfully logged in.' })