Given the fetch call is:
const response = await fetch('/api/auth/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ usernameInput, pwInput }),
And the route file is:
export async function POST(
req: NextApiRequest,
res: NextApiResponse
) {
try {
} catch (error) {
return NextResponse.json(
{
result: {}
},
{
status: 401,
statusText: "Invalid credentials."
}
);
}
}
How do I retrieve the usernameInput and pwInput inside the try-catch?