Skip to content

Commit

Permalink
debug auth api
Browse files Browse the repository at this point in the history
  • Loading branch information
rickimoore committed Jun 19, 2024
1 parent b5cb6ba commit 6077460
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion app/api/authenticate/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ export async function POST(req: Request) {

return NextResponse.json({token}, {status: 200})
} catch (error) {
return NextResponse.json({ error: error.response.data.message }, { status: 500 })
let message = error?.response?.data?.message

if(!message) {
message = 'authPrompt.defaultErrorMessage'
}
return NextResponse.json({ error: message }, { status: 500 })
}
}
3 changes: 2 additions & 1 deletion src/locales/translations/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,8 @@
"authenticate": "Authenticate",
"noPasswordFound": "No Session Password found",
"invalidPassword": "Invalid password. Please try again.",
"unableToReach": "Unable to reach backend."
"unableToReach": "Unable to reach backend.",
"defaultErrorMessage": "Error reaching backend server..."
},
"errorPage": {
"title": "Opps!",
Expand Down

0 comments on commit 6077460

Please sign in to comment.