Dagemark-Webapp/app/api/users/login/route.ts
2026-09-15 11:34:39 +02:00

25 lines
679 B
TypeScript

import logger from "@/lib/logging/logger";
const BACKEND_URL = process.env.BACKEND_URL;
export async function POST(request: Request) {
const indata = await request.json();
const body = new URLSearchParams({
username: indata.username,
password: indata.password,
});
logger.log("debug", `recieved users/login call with data: ${body}`); // for debugging login form calls
const response = await fetch(`${BACKEND_URL}/users/auth`, {
method: "POST",
body: body,
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
});
const data = await response.json();
return Response.json(data, {
status: response.status,
});
}