25 lines
663 B
TypeScript
25 lines
663 B
TypeScript
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,
|
|
});
|
|
console.log(`recieved users/login call with data: ${body}`);
|
|
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();
|
|
|
|
console.log(`Recieved data from user auth fetch data as ${data}`);
|
|
|
|
return Response.json(data, {
|
|
status: response.status,
|
|
});
|
|
}
|